codegen/generate_functions.rb in torch-rb-0.5.1 vs codegen/generate_functions.rb in torch-rb-0.5.2

- old
+ new

@@ -67,34 +67,31 @@ contents = template % {type: type} write_file("#{type}_functions.h", contents) end def write_body(type, method_defs, attach_defs) - cuda_lazy_init = %{\n#include "torch/csrc/utils/cuda_lazy_init.h"\n} unless type == "nn" - template = <<~EOS // generated by rake generate:functions // do not edit by hand #include <torch/torch.h> #include <rice/Module.hpp> #include "ruby_arg_parser.h" #include "templates.h" #include "wrap_outputs.h" - %{cuda_lazy_init} + %{method_defs} void add_%{type}_functions(Module m) { %{attach_defs} } EOS contents = template % { type: type, method_defs: method_defs.join("\n"), - attach_defs: attach_defs.join("\n "), - cuda_lazy_init: cuda_lazy_init + attach_defs: attach_defs.join("\n ") } write_file("#{type}_functions.cpp", contents) end def write_file(name, contents) @@ -288,10 +285,10 @@ end code += "\n .#{c}" end - "#{code};\n torch::utils::maybe_initialize_cuda(options);" + "#{code};" end def generate_function_code(function, cpp_name, params, opt_index, remove_self) params = generate_function_params(function, params, remove_self) if opt_index