aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.convert_to_tensor_or_indexed_slices.md
blob: 18cf6c58be4b0acb46b5ffe3049e87e07797b7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
### `tf.convert_to_tensor_or_indexed_slices(value, dtype=None, name=None)` {#convert_to_tensor_or_indexed_slices}

Converts the given object to a `Tensor` or an `IndexedSlices`.

If `value` is an `IndexedSlices` or `SparseTensor` it is returned
unmodified. Otherwise, it is converted to a `Tensor` using
`convert_to_tensor()`.

##### Args:


*  <b>`value`</b>: An `IndexedSlices`, `SparseTensor`, or an object that can be consumed
    by `convert_to_tensor()`.
*  <b>`dtype`</b>: (Optional.) The required `DType` of the returned `Tensor` or
    `IndexedSlices`.
*  <b>`name`</b>: (Optional.) A name to use if a new `Tensor` is created.

##### Returns:

  An `Tensor`, `IndexedSlices`, or `SparseTensor` based on `value`.

##### Raises:


*  <b>`ValueError`</b>: If `dtype` does not match the element type of `value`.