Spec-Zone.ru › TensorFlow

tf.distribute.experimental.partitioners.Partitioner

Базовый класс Partitioner: все partitioners наследуют от него.

Partitioners должны реализовывать метод __call__ со следующим сигнатуром:

def __call__(self, shape, dtype, axis=0):
  # Partitions the given `shape` and returns the partition results.
  # See docstring of `__call__` method for the format of partition results.

Методы

__call__

Просмотреть исходный код

__call__(
    shape, dtype, axis=0
)

Разделяет заданный shape и возвращает результаты разделения.

Примеры partitioner, который выделяет фиксированное количество фрагментов:

partitioner = FixedShardsPartitioner(num_shards=2)
partitions = partitioner(tf.TensorShape([10, 3], tf.float32), axis=0)
print(partitions) # [2, 0]
Аргументы
shape tf.TensorShape, форма для разделения.
dtype tf.dtypes.Dtype, указывающий тип значения разделения.
axis Ось для разделения. По умолчанию: внешняя ось.
Возвращаемое значение
Список целых чисел, представляющих количество разделов на каждой оси, где i-е значение соответствует i-й оси.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/distribute/experimental/partitioners/Partitioner

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API