Method: TensorFlow.convert_to_tensor
- Defined in:
- lib/tensorflow.rb
.convert_to_tensor(value, dtype: nil) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/tensorflow.rb', line 88 def convert_to_tensor(value, dtype: nil) value = Tensor.new(value, dtype: dtype) unless value.is_a?(Tensor) if dtype && value.dtype != dtype raise Error, "Tensor conversion requested dtype #{dtype} for Tensor with dtype #{value.dtype}" end value end |