tf.sparse.mask
| View source on GitHub |
Маскирует элементы IndexedSlices.
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/r1.15/api_docs/python/tf/sparse/mask