lib/dnn/core/param.rb in ruby-dnn-1.1.0 vs lib/dnn/core/param.rb in ruby-dnn-1.1.1
- old
+ new
@@ -36,21 +36,25 @@
def -@
Neg.(self)
end
def +(other)
+ other = Tensor.convert(other) unless other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
Layers::Add.(self, other)
end
def -(other)
+ other = Tensor.convert(other) unless other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
Layers::Sub.(self, other)
end
def *(other)
+ other = Tensor.convert(other) unless other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
Layers::Mul.(self, other)
end
def /(other)
+ other = Tensor.convert(other) unless other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
Layers::Div.(self, other)
end
def **(index)
Layers::Pow.new(index).(self)