tf.utils module

tf.utils module

tf.utils.boundary_cast(x, name=None)

Internal measure to ensure matching between Tensorflow and the CS-1.

Closest operation to match the mixed precision on the CS-1.

Parameters

x – The tensor to boundary cast.

Returns

The tensor x cast down to float16 and back to float32.

Return type

x

tf.utils.summarize_tensor(x, is_gradient_tensor=False, op_name_if_grad=None)

Attach a summary to the specified tensor.

This function is added separately from the summary_layer below, because some tensors might be generated using the tf.custom_gradients, which would disallow finding the gradient tensor using summary_layer. In such case, the user writing a custom gradient must manually specify the gradient tensor to summarize.

Parameters
  • x (tf.Tensor) – Tensor to summarize.

  • is_gradient_tensor (bool) – Boolean that decides whether to designate the tensor’s name as within the gradients.

  • op_name_if_grad (str) – If is_gradient_tensor==True, then use this name, prefixed by "gradients/", as the summary name.

tf.utils.summary_layer(x)

Attaches a summary to a tensor and its delta.

Parameters

x (tf.Tensor) – Tensor to summarize.