返回张量的大小。
用法
tf.compat.v1.size(
input, name=None, out_type=tf.dtypes.int32
)
参数
-
input
一个Tensor
或SparseTensor
。 -
name
操作的名称(可选)。 -
out_type
(可选)操作的指定非量化数值输出类型。默认为tf.int32
。
返回
-
Tensor
类型为out_type
。默认为tf.int32
。
返回一个 0-D Tensor
表示 input
类型为 out_type
的元素数。默认为 tf.int32。
例如:
t = tf.constant([[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]])
tf.size(t) # 12
numpy 兼容性
相当于 np.size()
相关用法
- Python tf.compat.v1.strings.length用法及代码示例
- Python tf.compat.v1.scatter_min用法及代码示例
- Python tf.compat.v1.summary.merge用法及代码示例
- Python tf.compat.v1.scatter_add用法及代码示例
- Python tf.compat.v1.summary.FileWriter用法及代码示例
- Python tf.compat.v1.scatter_div用法及代码示例
- Python tf.compat.v1.space_to_batch用法及代码示例
- Python tf.compat.v1.string_split用法及代码示例
- Python tf.compat.v1.squeeze用法及代码示例
- Python tf.compat.v1.set_random_seed用法及代码示例
- Python tf.compat.v1.sparse_to_dense用法及代码示例
- Python tf.compat.v1.sparse_segment_sum用法及代码示例
- Python tf.compat.v1.scatter_update用法及代码示例
- Python tf.compat.v1.sparse_split用法及代码示例
- Python tf.compat.v1.string_to_number用法及代码示例
- Python tf.compat.v1.saved_model.simple_save用法及代码示例
- Python tf.compat.v1.scatter_nd_sub用法及代码示例
- Python tf.compat.v1.sparse_reduce_max用法及代码示例
- Python tf.compat.v1.shape用法及代码示例
- Python tf.compat.v1.setdiff1d用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.v1.size。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。