Spec-Zone.ru › TensorFlow 2.4

tf.sparse.mask

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

Маскирует элементы IndexedSlices.

Просмотр псевдонимов

Псевдонимы для миграции

Дополнительные сведения см. в руководстве по миграции.

tf.compat.v1.sparse.mask, tf.compat.v1.sparse_mask

tf.sparse.mask(
    a, mask_indices, name=None
)

Принимая экземпляр IndexedSlices, a, возвращает другой экземпляр IndexedSlices, содержащий подмножество слайсов a. Возвращаются только слайсы с индексами, не указанными в mask_indices.

Это полезно, когда вам нужно извлечь подмножество слайсов из объекта IndexedSlices.

Например:

# `a` contains slices at indices [12, 26, 37, 45] from a large tensor
# with shape [1000, 10]
a.indices  # [12, 26, 37, 45]
tf.shape(a.values)  # [4, 10]

# `b` will be the subset of `a` slices at its second and third indices, so
# we want to mask its first and last indices (which are at absolute
# indices 12, 45)
b = tf.sparse.mask(a, [12, 45])

b.indices  # [26, 37]
tf.shape(b.values)  # [2, 10]
Аргументы
a Экземпляр IndexedSlices.
mask_indices Индексы элементов для маскирования.
name Имя операции (необязательно).
Возвращаемое значение
Экземпляр маскированного IndexedSlices.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/sparse/mask

Spec-Zone.ru

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