Пример #1
0
 def record():
   """Record the actual summary and return True."""
   # Note the identity to move the tensor to the CPU.
   with ops.device("cpu:0"):
     write_summary_op = gen_summary_ops.write_summary(
         context.context().summary_writer_resource,
         step,
         array_ops.identity(tensor),
         tag,
         serialized_metadata,
         name=scope)
     with ops.control_dependencies([write_summary_op]):
       return constant_op.constant(True)
Пример #2
0
 def record():
   """Record the actual summary and return True."""
   # Note the identity to move the tensor to the CPU.
   with ops.device("cpu:0"):
     write_summary_op = gen_summary_ops.write_summary(
         context.context().summary_writer._resource,  # pylint: disable=protected-access
         step,
         array_ops.identity(tensor),
         tag,
         serialized_metadata,
         name=scope)
     with ops.control_dependencies([write_summary_op]):
       return constant_op.constant(True)
 def record():
     """Record the actual summary and return True."""
     # Note the identity to move the tensor to the CPU.
     with ops.device("cpu:0"):
         write_summary_op = gen_summary_ops.write_summary(
             _summary_state.writer._resource,  # pylint: disable=protected-access
             step,
             array_ops.identity(tensor),
             tag,
             serialized_metadata,
             name=scope)
         with ops.control_dependencies([write_summary_op]):
             return constant_op.constant(True)
Пример #4
0
 def function(tag, scope):
   if metadata is None:
     serialized_metadata = constant_op.constant("")
   elif hasattr(metadata, "SerializeToString"):
     serialized_metadata = constant_op.constant(metadata.SerializeToString())
   else:
     serialized_metadata = metadata
   # Note the identity to move the tensor to the CPU.
   return gen_summary_ops.write_summary(
       context.context().summary_writer_resource,
       _choose_step(step),
       array_ops.identity(tensor),
       tag,
       serialized_metadata,
       name=scope)
Пример #5
0
 def function(tag, scope):
   if metadata is None:
     serialized_metadata = constant_op.constant("")
   elif hasattr(metadata, "SerializeToString"):
     serialized_metadata = constant_op.constant(metadata.SerializeToString())
   else:
     serialized_metadata = metadata
   # Note the identity to move the tensor to the CPU.
   return gen_summary_ops.write_summary(
       _summary_state.writer._resource,  # pylint: disable=protected-access
       _choose_step(step),
       array_ops.identity(tensor),
       tag,
       serialized_metadata,
       name=scope)
Пример #6
0
 def function(tag, scope):
   if metadata is None:
     serialized_metadata = constant_op.constant("")
   elif hasattr(metadata, "SerializeToString"):
     serialized_metadata = constant_op.constant(metadata.SerializeToString())
   else:
     serialized_metadata = metadata
   # Note the identity to move the tensor to the CPU.
   return gen_summary_ops.write_summary(
       context.context().summary_writer_resource,
       _choose_step(step),
       array_ops.identity(tensor),
       tag,
       serialized_metadata,
       name=scope)
Пример #7
0
        def record():
            """Record the actual summary and return True."""
            if step is None:
                raise ValueError("No step set via 'step' argument or "
                                 "tf.summary.experimental.set_step()")

            # Note the identity to move the tensor to the CPU.
            with ops.device("cpu:0"):
                summary_tensor = tensor() if callable(
                    tensor) else array_ops.identity(tensor)
                write_summary_op = gen_summary_ops.write_summary(
                    _summary_state.writer._resource,  # pylint: disable=protected-access
                    step,
                    summary_tensor,
                    tag,
                    serialized_metadata,
                    name=scope)
                with ops.control_dependencies([write_summary_op]):
                    return constant_op.constant(True)