lib/dnn/core/param.rb in ruby-dnn-0.16.0 vs lib/dnn/core/param.rb in ruby-dnn-0.16.1
- old
+ new
@@ -22,7 +22,39 @@
end
else
@grad = Xumo::SFloat[0]
end
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