17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/torch/native/generator.rb', line 17
def grouped_functions
functions = functions()
skip_args = ["Layout", "Storage", "ConstQuantizerPtr"]
functions.reject! do |f|
f.ruby_name.start_with?("_") ||
f.ruby_name.include?("_backward") ||
f.args.any? { |a| a[:type].include?("Dimname") }
end
todo_functions, functions =
functions.partition do |f|
f.args.any? do |a|
skip_args.any? { |sa| a[:type].include?(sa) } ||
f.cpp_name == "_range" ||
(f.base_name == "normal" && !f.out?)
end
end
nn_functions, other_functions = functions.partition { |f| f.python_module == "nn" }
torch_functions = other_functions.select { |f| f.variants.include?("function") }
tensor_functions = other_functions.select { |f| f.variants.include?("method") }
{torch: torch_functions, tensor: tensor_functions, nn: nn_functions}
end
|