codegen/generate_functions.rb in torch-rb-0.8.1 vs codegen/generate_functions.rb in torch-rb-0.8.2

- old
+ new

@@ -21,11 +21,11 @@ YAML.load_file(path).map { |f| Function.new(f) }.sort_by(&:name) end def skip_functions(functions) functions.reject do |f| - f.base_name.start_with?("_") || + (f.base_name.start_with?("_") && f.base_name != "__lshift__" && f.base_name != "__rshift__") || f.base_name.include?("_backward") || f.base_name.include?("_forward") || f.base_name == "to" || f.base_name == "record_stream" || # in ext.cpp @@ -131,9 +131,10 @@ ruby_name = "_#{ruby_name}" if ["size", "stride", "random!", "stft"].include?(ruby_name) ruby_name = ruby_name.sub(/\Afft_/, "") if type == "fft" ruby_name = ruby_name.sub(/\Alinalg_/, "") if type == "linalg" ruby_name = ruby_name.sub(/\Aspecial_/, "") if type == "special" + ruby_name = name if name.start_with?("__") # cast for Ruby < 2.7 https://github.com/thisMagpie/fftw/issues/22#issuecomment-49508900 cast = RUBY_VERSION.to_f > 2.7 ? "" : "(VALUE (*)(...)) " "rb_#{def_method}(m, \"#{ruby_name}\", #{cast}#{full_name(name, type)}, -1);"