Spec-Zone.ru › TensorFlow 2.3

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.3/api_docs/python/tf/sparse/mask

Spec-Zone.ru

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