def variable_summaries(var):
"""Attach a lot of summaries to a Tensor (for TensorBoard visualization)."""
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('max', tf.reduce_max(var))
tf.summary.scalar('min', tf.reduce_min(var))
tf.summary.histogram('histogram', var)
python类scalar()的实例源码
def size(self, name=None):
"""Compute the number of elements in this table.
Args:
name: A name for the operation (optional).
Returns:
A scalar tensor containing the number of elements in this table.
"""
if name is None:
name = "%s_Size" % self._name
# pylint: disable=protected-access
return gen_data_flow_ops._lookup_table_size(self._table_ref, name=name)
# pylint: enable=protected-access
def size(self, name=None):
"""Compute the number of elements in this table.
Args:
name: A name for the operation (optional).
Returns:
A scalar tensor containing the number of elements in this table.
"""
with ops.name_scope(name, "%s_Size" % self._name,
[self._table_ref]) as name:
# pylint: disable=protected-access
return gen_data_flow_ops._lookup_table_size(self._table_ref, name=name)
# pylint: enable=protected-access
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def size(self, name=None):
"""Compute the number of elements in this table.
Args:
name: A name for the operation (optional).
Returns:
A scalar tensor containing the number of elements in this table.
"""
with ops.name_scope(name, "%s_Size" % self._name,
[self._table_ref]) as name:
# pylint: disable=protected-access
return gen_data_flow_ops._lookup_table_size(self._table_ref, name=name)
def size(self, name=None):
"""Compute the number of elements in this table.
Args:
name: A name for the operation (optional).
Returns:
A scalar tensor containing the number of elements in this table.
"""
with ops.name_scope(name, "%s_Size" % self._name,
[self._table_ref]) as name:
# pylint: disable=protected-access
return gen_data_flow_ops._lookup_table_size(self._table_ref, name=name)
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()
def _get_event_shape(self):
return tensor_shape.scalar()