module Tensorflow::TensorMixin
Public Instance Methods
numo()
click to toggle source
# 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()
click to toggle source
# 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