Converts `values` to a list of `Tensor` objects. Args: values: A list of objects that can be consumed by `tf.convert_to_tensor()`. dtype: (Optional.) The required `DType` of the returned `Tensor` objects. name: (Optional.) A name prefix to used when a new `Tensor` is created, in
(values, dtype=None, name=None, preferred_dtype=None)
| 1364 | |
| 1365 | |
| 1366 | def convert_n_to_tensor(values, dtype=None, name=None, preferred_dtype=None): |
| 1367 | """Converts `values` to a list of `Tensor` objects. |
| 1368 | |
| 1369 | Args: |
| 1370 | values: A list of objects that can be consumed by `tf.convert_to_tensor()`. |
| 1371 | dtype: (Optional.) The required `DType` of the returned `Tensor` objects. |
| 1372 | name: (Optional.) A name prefix to used when a new `Tensor` is created, in |
| 1373 | which case element `i` will be given the name `name + '_' + i`. |
| 1374 | preferred_dtype: Optional element type for the returned tensors, used when |
| 1375 | dtype is None. In some cases, a caller may not have a dtype in mind when |
| 1376 | converting to a tensor, so preferred_dtype can be used as a soft |
| 1377 | preference. If the conversion to `preferred_dtype` is not possible, this |
| 1378 | argument has no effect. |
| 1379 | |
| 1380 | Returns: |
| 1381 | A list of `Tensor` and/or `IndexedSlices` objects. |
| 1382 | |
| 1383 | Raises: |
| 1384 | TypeError: If no conversion function is registered for an element in |
| 1385 | `values`. |
| 1386 | RuntimeError: If a registered conversion function returns an invalid |
| 1387 | value. |
| 1388 | """ |
| 1389 | return internal_convert_n_to_tensor( |
| 1390 | values=values, |
| 1391 | dtype=dtype, |
| 1392 | name=name, |
| 1393 | preferred_dtype=preferred_dtype, |
| 1394 | as_ref=False) |
| 1395 | |
| 1396 | |
| 1397 | def convert_to_tensor_or_composite(value, dtype=None, name=None): |
nothing calls this directly
no test coverage detected