當前位置: 首頁>>代碼示例>>Python>>正文


Python resources.report_uninitialized_resources方法代碼示例

本文整理匯總了Python中tensorflow.python.ops.resources.report_uninitialized_resources方法的典型用法代碼示例。如果您正苦於以下問題:Python resources.report_uninitialized_resources方法的具體用法?Python resources.report_uninitialized_resources怎麽用?Python resources.report_uninitialized_resources使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tensorflow.python.ops.resources的用法示例。


在下文中一共展示了resources.report_uninitialized_resources方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: finalize

# 需要導入模塊: from tensorflow.python.ops import resources [as 別名]
# 或者: from tensorflow.python.ops.resources import report_uninitialized_resources [as 別名]
def finalize(self):
    """Creates operations if needed and finalizes the graph."""
    if self._init_op is None:
      def default_init_op():
        return control_flow_ops.group(
            variables.global_variables_initializer(),
            resources.initialize_resources(resources.shared_resources()))
      self._init_op = Scaffold.get_or_default(
          'init_op',
          ops.GraphKeys.INIT_OP,
          default_init_op)
    if self._ready_op is None:
      def default_ready_op():
        return array_ops.concat(
            0,
            [variables.report_uninitialized_variables(),
             resources.report_uninitialized_resources()])
      self._ready_op = Scaffold.get_or_default(
          'ready_op', ops.GraphKeys.READY_OP,
          default_ready_op)
    if self._local_init_op is None:
      self._local_init_op = Scaffold.get_or_default(
          'local_init_op', ops.GraphKeys.LOCAL_INIT_OP,
          Scaffold._default_local_init_op)
    if self._summary_op is None:
      self._summary_op = Scaffold.get_or_default('summary_op',
                                                 ops.GraphKeys.SUMMARY_OP,
                                                 summary.merge_all)
    # pylint: disable=g-long-lambda
    if self._saver is None:
      self._saver = Scaffold.get_or_default(
          'saver',
          ops.GraphKeys.SAVERS,
          lambda: training_saver.Saver(sharded=True, allow_empty=True,
                                       write_version=saver_pb2.SaverDef.V2))
    # pylint: enable=g-long-lambda
    self._saver.build()

    ops.get_default_graph().finalize()
    return self 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:42,代碼來源:monitored_session.py

示例2: testInitialize

# 需要導入模塊: from tensorflow.python.ops import resources [as 別名]
# 或者: from tensorflow.python.ops.resources import report_uninitialized_resources [as 別名]
def testInitialize(self):
    with self.test_session():
      handle = test_ops.stub_resource_handle_op(container="a", shared_name="b")
      resources.register_resource(
          handle=handle,
          create_op=test_ops.resource_create_op(handle),
          is_initialized_op=test_ops.resource_initialized_op(handle))
      self.assertEquals(len(resources.report_uninitialized_resources(
          resources.shared_resources()).eval()), 1)
      resources.initialize_resources(resources.shared_resources()).run()
      self.assertEquals(len(resources.report_uninitialized_resources(
          resources.shared_resources()).eval()), 0) 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:14,代碼來源:ops_test.py

示例3: finalize

# 需要導入模塊: from tensorflow.python.ops import resources [as 別名]
# 或者: from tensorflow.python.ops.resources import report_uninitialized_resources [as 別名]
def finalize(self):
    """Creates operations if needed and finalizes the graph."""
    if self._init_op is None:
      def default_init_op():
        return control_flow_ops.group(
            variables.global_variables_initializer(),
            resources.initialize_resources(resources.shared_resources()))
      self._init_op = Scaffold.get_or_default(
          'init_op',
          ops.GraphKeys.INIT_OP,
          default_init_op)
    if self._ready_op is None:
      def default_ready_op():
        return array_ops.concat([
            variables.report_uninitialized_variables(),
            resources.report_uninitialized_resources()
        ], 0)
      self._ready_op = Scaffold.get_or_default(
          'ready_op', ops.GraphKeys.READY_OP,
          default_ready_op)
    if self._ready_for_local_init_op is None:
      def default_ready_for_local_init_op():
        return variables.report_uninitialized_variables(
            variables.global_variables())
      self._ready_for_local_init_op = Scaffold.get_or_default(
          'ready_for_local_init_op', ops.GraphKeys.READY_FOR_LOCAL_INIT_OP,
          default_ready_for_local_init_op)
    if self._local_init_op is None:
      self._local_init_op = Scaffold.get_or_default(
          'local_init_op', ops.GraphKeys.LOCAL_INIT_OP,
          Scaffold._default_local_init_op)
    if self._summary_op is None:
      self._summary_op = Scaffold.get_or_default('summary_op',
                                                 ops.GraphKeys.SUMMARY_OP,
                                                 summary.merge_all)
    # pylint: disable=g-long-lambda
    if self._saver is None:
      self._saver = training_saver._get_saver_or_default()  # pylint: disable=protected-access
    # pylint: enable=g-long-lambda
    self._saver.build()

    ops.get_default_graph().finalize()
    return self 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:45,代碼來源:monitored_session.py

示例4: finalize

# 需要導入模塊: from tensorflow.python.ops import resources [as 別名]
# 或者: from tensorflow.python.ops.resources import report_uninitialized_resources [as 別名]
def finalize(self):
    """Creates operations if needed and finalizes the graph."""
    if self._init_op is None:
      def default_init_op():
        return control_flow_ops.group(
            variables.global_variables_initializer(),
            resources.initialize_resources(resources.shared_resources()))
      self._init_op = Scaffold.get_or_default(
          'init_op',
          ops.GraphKeys.INIT_OP,
          default_init_op)
    if self._ready_op is None:
      def default_ready_op():
        return array_ops.concat([
            variables.report_uninitialized_variables(),
            resources.report_uninitialized_resources()
        ], 0)
      self._ready_op = Scaffold.get_or_default(
          'ready_op', ops.GraphKeys.READY_OP,
          default_ready_op)
    if self._ready_for_local_init_op is None:
      def default_ready_for_local_init_op():
        return variables.report_uninitialized_variables(
            variables.global_variables())
      self._ready_for_local_init_op = Scaffold.get_or_default(
          'ready_for_local_init_op', ops.GraphKeys.READY_FOR_LOCAL_INIT_OP,
          default_ready_for_local_init_op)
    if self._local_init_op is None:
      self._local_init_op = Scaffold.get_or_default(
          'local_init_op', ops.GraphKeys.LOCAL_INIT_OP,
          Scaffold._default_local_init_op)
    if self._summary_op is None:
      self._summary_op = Scaffold.get_or_default('summary_op',
                                                 ops.GraphKeys.SUMMARY_OP,
                                                 summary.merge_all)
    # pylint: disable=g-long-lambda
    if self._saver is None:
      self._saver = Scaffold.get_or_default(
          'saver',
          ops.GraphKeys.SAVERS,
          lambda: training_saver.Saver(sharded=True, allow_empty=True,
                                       write_version=saver_pb2.SaverDef.V2))
    # pylint: enable=g-long-lambda
    self._saver.build()

    ops.get_default_graph().finalize()
    return self 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:49,代碼來源:monitored_session.py

示例5: finalize

# 需要導入模塊: from tensorflow.python.ops import resources [as 別名]
# 或者: from tensorflow.python.ops.resources import report_uninitialized_resources [as 別名]
def finalize(self):
    """Creates operations if needed and finalizes the graph."""
    if self._init_op is None:
      def default_init_op():
        return tf.group(
            tf.global_variables_initializer(),
            resources.initialize_resources(resources.shared_resources()))
      self._init_op = TransferScaffold.get_or_default(
          'init_op',
          tf.GraphKeys.INIT_OP,
          default_init_op)
    if self._ready_op is None:
      def default_ready_op():
        return tf.concat([
            tf.report_uninitialized_variables(),
            resources.report_uninitialized_resources()
        ], 0)
      self._ready_op = TransferScaffold.get_or_default(
          'ready_op', tf.GraphKeys.READY_OP,
          default_ready_op)
    if self._ready_for_local_init_op is None:
      def default_ready_for_local_init_op():
        return tf.report_uninitialized_variables(
            tf.global_variables())
      self._ready_for_local_init_op = TransferScaffold.get_or_default(
          'ready_for_local_init_op', tf.GraphKeys.READY_FOR_LOCAL_INIT_OP,
          default_ready_for_local_init_op)
    if self._local_init_op is None:
      self._local_init_op = TransferScaffold.get_or_default(
          'local_init_op', tf.GraphKeys.LOCAL_INIT_OP,
          TransferScaffold.default_local_init_op)
    if self._summary_op is None:
      self._summary_op = TransferScaffold.get_or_default(
          'summary_op', tf.GraphKeys.SUMMARY_OP, tf.summary.merge_all)
    # pylint: disable=g-long-lambda
    if self._saver is None:
      self._saver = training_saver._get_saver_or_default()  # pylint: disable=protected-access
    # pylint: enable=g-long-lambda
    self._saver.build()

    # ops.get_default_graph().finalize()
    # logging.info('Graph was finalized.')
    return self 
開發者ID:NVIDIA,項目名稱:OpenSeq2Seq,代碼行數:45,代碼來源:helpers.py


注:本文中的tensorflow.python.ops.resources.report_uninitialized_resources方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。