MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / size

Function size

tensorflow/python/ops/ragged/ragged_array_ops.py:472–494  ·  view source on GitHub ↗

Returns the size of a potentially ragged tensor. The size of a ragged tensor is the size of its inner values. Args: input: A potentially ragged `Tensor`. out_type: The numeric output type for the operation. name: A name for the operation (optional). Returns: A Tensor of type

(input, out_type=dtypes.int32, name=None)

Source from the content-addressed store, hash-verified

470
471
472def size(input, out_type=dtypes.int32, name=None): # pylint: disable=redefined-builtin
473 """Returns the size of a potentially ragged tensor.
474
475 The size of a ragged tensor is the size of its inner values.
476
477 Args:
478 input: A potentially ragged `Tensor`.
479 out_type: The numeric output type for the operation.
480 name: A name for the operation (optional).
481
482 Returns:
483 A Tensor of type `out_type`.
484
485 #### Example:
486 ```python
487 >>> tf.size(tf.ragged.constant([[1, 2], [3]]))
488 3
489 ```
490 """
491 if ragged_tensor.is_ragged(input):
492 return array_ops.size(input.flat_values, out_type=out_type, name=name)
493 else:
494 return array_ops.size(input, out_type=out_type, name=name)
495
496
497#===============================================================================

Callers

nothing calls this directly

Calls 2

is_raggedMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected