lib/torch/native/parser.rb in torch-rb-0.3.5 vs lib/torch/native/parser.rb in torch-rb-0.3.6
- old
+ new
@@ -83,10 +83,14 @@
else
v.is_a?(Integer)
end
when "int?"
v.is_a?(Integer) || v.nil?
+ when "float?"
+ v.is_a?(Numeric) || v.nil?
+ when "bool?"
+ v == true || v == false || v.nil?
when "float"
v.is_a?(Numeric)
when /int\[.*\]/
if v.is_a?(Integer)
size = t[4..-2]
@@ -95,9 +99,13 @@
values[k] = v
end
v.is_a?(Array) && v.all? { |v2| v2.is_a?(Integer) }
when "Scalar"
v.is_a?(Numeric)
+ when "Scalar?"
+ v.is_a?(Numeric) || v.nil?
+ when "ScalarType"
+ false # not supported yet
when "ScalarType?"
v.nil?
when "bool"
v == true || v == false
when "str"