Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion torch/csrc/utils/python_arg_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ void FunctionParameter::set_default_str(const std::string& str) {
} else {
// we sometimes rely on integer-vs-float values, e.g. with arange.
const auto as_integer = parse_as_integer(str);
default_scalar = at::Scalar(as_integer.value_or(atof(str.c_str())));
default_scalar = as_integer.has_value() ? at::Scalar(as_integer.value()) :

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

at::Scalar(atof(str.c_str()));
}
} else if (type_ == ParameterType::INT_LIST) {
if (str != "None") {
Expand Down