MCPcopy Create free account
hub / github.com/tensorflow/tensorboard / lazy_tensor

Function lazy_tensor

tensorboard/plugins/image/summary_v2.py:111–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109 # only do this work when summaries are actually written.
110 @lazy_tensor_creator.LazyTensorCreator
111 def lazy_tensor():
112 tf.debugging.assert_rank(data, 4)
113 tf.debugging.assert_non_negative(max_outputs)
114 images = tf.image.convert_image_dtype(data, tf.uint8, saturate=True)
115 limited_images = images[:max_outputs]
116 encoded_images = tf.image.encode_png(limited_images)
117 image_shape = tf.shape(input=images)
118 dimensions = tf.stack(
119 [
120 tf.as_string(image_shape[2], name="width"),
121 tf.as_string(image_shape[1], name="height"),
122 ],
123 name="dimensions",
124 )
125 return tf.concat([dimensions, encoded_images], axis=0)
126
127 # To ensure that image encoding logic is only executed when summaries
128 # are written, we pass callable to `tensor` parameter.

Calls 1

concatMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…