Sha256: dfe22004274064168df595f930c8935b437c25e8d404bc9e13876ff78adb35b2
Contents?: true
Size: 733 Bytes
Versions: 3
Compression:
Stored size: 733 Bytes
Contents
module DNN class Tensor attr_reader :data attr_accessor :link def self.convert(inputs) if inputs.is_a?(Array) inputs.map { |input| Tensor.new(input) } else Tensor.new(inputs) end end def initialize(data, link = nil) @data = data @link = link end def shape @data.shape end def +@ self end def -@ self * -1 end def +(other) Layers::Add.(self, other) end def -(other) Layers::Sub.(self, other) end def *(other) Layers::Mul.(self, other) end def /(other) Layers::Div.(self, other) end def **(index) Layers::Pow.new(index).(self) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-dnn-0.16.2 | lib/dnn/core/tensor.rb |
ruby-dnn-0.16.1 | lib/dnn/core/tensor.rb |
ruby-dnn-0.16.0 | lib/dnn/core/tensor.rb |