当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python tf.distribute.experimental.partitioners.Partitioner.__call__用法及代码示例


用法

__call__(
    shape, dtype, axis=0
)

参数

  • shape a tf.TensorShape ,要分区的形状。
  • dtype tf.dtypes.Dtype 指示分区值的类型。
  • axis 要分割的轴。默认值:最外轴。

返回

  • 表示每个轴上的分区数的整数列表,其中 i-th 值对应于 i-th 轴。

对给定的shape 进行分区并返回分区结果。

分配固定数量分片的分区器示例:

partitioner = FixedShardsPartitioner(num_shards=2)
partitions = partitioner(tf.TensorShape([10, 3], tf.float32), axis=0)
print(partitions) # [2, 0]

相关用法


注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.distribute.experimental.partitioners.Partitioner.__call__。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。