tf.compat.v1.convert_to_tensor_or_indexed_slices
Преобразует данный объект в Tensor или IndexedSlices.
tf.compat.v1.convert_to_tensor_or_indexed_slices(
value, dtype=None, name=None
)
Если value является IndexedSlices или SparseTensor, он возвращается без изменений. В противном случае он преобразуется в Tensor с помощью convert_to_tensor().
| Аргументы | |
|---|---|
value | IndexedSlices, SparseTensor, или объект, который может быть использован convert_to_tensor(). |
dtype | (Необязательно.) Требуемый DType возвращаемого Tensor или IndexedSlices. |
name | (Необязательно.) Имя для использования, если создаётся новый Tensor. |
| Возвращаемое значение | |
|---|---|
Tensor, IndexedSlices, или SparseTensor в зависимости от value. |
| Исключения | |
|---|---|
ValueError | Если dtype не соответствует типу элемента value. |
© 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/versions/r2.9/api_docs/python/tf/compat/v1/convert_to_tensor_or_indexed_slices