Module: Tensorflow::TensorMixin
- Included in:
- Eager::TensorHandle, Tensor
- Defined in:
- lib/tensorflow/tensor_mixin.rb
Instance Method Summary collapse
Instance Method Details
#numo ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tensorflow/tensor_mixin.rb', line 17 def numo case dtype when NilClass nil when :variant :variant when :string :string else klass = TensorData::DTYPE_TO_NUMO_TYPE_MAP[dtype] raise "Unknown type: #{dtype}" unless klass klass.cast(value) end end |
#shape ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tensorflow/tensor_mixin.rb', line 3 def shape @shape ||= begin status = Status.new shape = [] if self num_dims.times do |i| shape << dim(i) status.check end end shape end end |