Skip to content

Commit b04cc65

Browse files
authored
Handle scalar float input in pybindings
Differential Revision: D104910685 Pull Request resolved: #19529
1 parent 2ea50ac commit b04cc65

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

extension/pybindings/pybindings.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,8 @@ struct PyModule final {
807807
cpp_inputs.push_back(EValue(py::cast<bool>(python_input)));
808808
} else if (py::isinstance<py::int_>(python_input)) {
809809
cpp_inputs.push_back(EValue(py::cast<int64_t>(python_input)));
810+
} else if (py::isinstance<py::float_>(python_input)) {
811+
cpp_inputs.push_back(EValue(py::cast<double>(python_input)));
810812
} else {
811813
throw std::runtime_error(
812814
"Unsupported python type " + type_str +
@@ -1135,6 +1137,8 @@ struct PyMethod final {
11351137
cpp_inputs.push_back(EValue(py::cast<bool>(python_input)));
11361138
} else if (py::isinstance<py::int_>(python_input)) {
11371139
cpp_inputs.push_back(EValue(py::cast<int64_t>(python_input)));
1140+
} else if (py::isinstance<py::float_>(python_input)) {
1141+
cpp_inputs.push_back(EValue(py::cast<double>(python_input)));
11381142
} else {
11391143
throw std::runtime_error(
11401144
"Unsupported python type " + type_str +

0 commit comments

Comments
 (0)