Convert the input `x` to a tensor of type `dtype`. This is slightly faster than the _to_tensor function, at the cost of handling fewer cases. Arguments: x: An object to be converted (numpy arrays, floats, ints and lists of them). dtype: The destination type. Returns:
(x, dtype)
| 652 | |
| 653 | |
| 654 | def _constant_to_tensor(x, dtype): |
| 655 | """Convert the input `x` to a tensor of type `dtype`. |
| 656 | |
| 657 | This is slightly faster than the _to_tensor function, at the cost of |
| 658 | handling fewer cases. |
| 659 | |
| 660 | Arguments: |
| 661 | x: An object to be converted (numpy arrays, floats, ints and lists of |
| 662 | them). |
| 663 | dtype: The destination type. |
| 664 | |
| 665 | Returns: |
| 666 | A tensor. |
| 667 | """ |
| 668 | return constant_op.constant(x, dtype=dtype) |
| 669 | |
| 670 | |
| 671 | def _to_tensor(x, dtype): |
no test coverage detected