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

Function size

tensorflow/python/ops/array_ops.py:506–533  ·  view source on GitHub ↗

Returns the size of a tensor. Returns a 0-D `Tensor` representing the number of elements in `input` of type `out_type`. Defaults to tf.int32. For example: ```python t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]) tf.size(t) # 12 ``` Args: input: A `Tensor`

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

Source from the content-addressed store, hash-verified

504@tf_export(v1=["size"])
505@dispatch.add_dispatch_support
506def size(input, name=None, out_type=dtypes.int32):
507 # pylint: disable=redefined-builtin
508 """Returns the size of a tensor.
509
510 Returns a 0-D `Tensor` representing the number of elements in `input`
511 of type `out_type`. Defaults to tf.int32.
512
513 For example:
514
515 ```python
516 t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
517 tf.size(t) # 12
518 ```
519
520 Args:
521 input: A `Tensor` or `SparseTensor`.
522 name: A name for the operation (optional).
523 out_type: (Optional) The specified non-quantized numeric output type of the
524 operation. Defaults to `tf.int32`.
525
526 Returns:
527 A `Tensor` of type `out_type`. Defaults to `tf.int32`.
528
529 @compatibility(numpy)
530 Equivalent to np.size()
531 @end_compatibility
532 """
533 return size_internal(input, name, optimize=True, out_type=out_type)
534
535
536def size_internal(input, name=None, optimize=True, out_type=dtypes.int32):

Callers 15

size_v2Function · 0.70
meshgridFunction · 0.70
IsSameAsMethod · 0.50
ElementCountMethod · 0.50
ElementCountMethod · 0.50
LogAllocationMethod · 0.50
operator()Method · 0.50
operator()Method · 0.50
operator()Method · 0.50
ToShapeMethod · 0.50
DimensionsProductMethod · 0.50

Calls 1

size_internalFunction · 0.85

Tested by

no test coverage detected