lib/torch/nn/linear.rb in torch-rb-0.1.2 vs lib/torch/nn/linear.rb in torch-rb-0.1.3
- old
+ new
@@ -18,14 +18,14 @@
def call(input)
F.linear(input, @weight, @bias)
end
def reset_parameters
- Init.kaiming_uniform_(@weight, Math.sqrt(5))
+ Init.kaiming_uniform!(@weight, Math.sqrt(5))
if @bias
fan_in, _ = Init.calculate_fan_in_and_fan_out(@weight)
bound = 1 / Math.sqrt(fan_in)
- Init.uniform_(@bias, -bound, bound)
+ Init.uniform!(@bias, -bound, bound)
end
end
def inspect
"Linear(in_features: #{@in_features.inspect}, out_features: #{@out_features.inspect}, bias: #{(!@bias.nil?).inspect})"