codegen/generate_functions.rb in torch-rb-0.6.0 vs codegen/generate_functions.rb in torch-rb-0.7.0
- old
+ new
@@ -73,11 +73,11 @@
template = <<~EOS
// generated by rake generate:functions
// do not edit by hand
#include <torch/torch.h>
- #include <rice/Module.hpp>
+ #include <rice/rice.hpp>
#include "ruby_arg_parser.h"
#include "templates.h"
#include "wrap_outputs.h"
@@ -117,10 +117,10 @@
"rb_#{def_method}(m, \"#{ruby_name}\", #{cast}#{type}_#{name}, -1);"
end
def generate_method_def(name, functions, type, def_method)
- assign_self = type == "tensor" ? "\n Tensor& self = from_ruby<Tensor&>(self_);" : ""
+ assign_self = type == "tensor" ? "\n Tensor& self = Rice::detail::From_Ruby<Tensor&>().convert(self_);" : ""
functions = group_overloads(functions, type)
signatures = functions.map { |f| f["signature"] }
max_args = signatures.map { |s| s.count(",") - s.count("*") }.max + 1
dispatches = add_dispatches(functions, def_method)