get_rank

tfsnippet.utils.get_rank(tensor, name=None)

Get the rank of the tensor.

Parameters:
  • tensor (tf.Tensor) – The tensor to be tested.
  • name (str) – TensorFlow name scope of the graph nodes.
  • name – Default name of the name scope. If not specified, generate one according to the method name.
Returns:

The rank.

Return type:

int or tf.Tensor