ext/torch/nn.cpp in torch-rb-0.13.0 vs ext/torch/nn.cpp in torch-rb-0.13.1
- old
+ new
@@ -12,15 +12,13 @@
Parameter(Tensor&& t) : torch::autograd::Variable(t) { }
};
void init_nn(Rice::Module& m) {
auto rb_mNN = Rice::define_module_under(m, "NN");
- rb_mNN.add_handler<torch::Error>(handle_error);
add_nn_functions(rb_mNN);
Rice::define_module_under(rb_mNN, "Init")
- .add_handler<torch::Error>(handle_error)
.define_singleton_function(
"_calculate_gain",
[](NonlinearityType nonlinearity, double param) {
return torch::nn::init::calculate_gain(nonlinearity, param);
})
@@ -89,10 +87,9 @@
[](Tensor tensor, double sparsity, double std) {
return torch::nn::init::sparse_(tensor, sparsity, std);
});
Rice::define_class_under<Parameter, torch::Tensor>(rb_mNN, "Parameter")
- .add_handler<torch::Error>(handle_error)
.define_method(
"grad",
[](Parameter& self) {
auto grad = self.grad();
return grad.defined() ? Object(Rice::detail::To_Ruby<torch::Tensor>().convert(grad)) : Nil;