| 223 | } |
| 224 | |
| 225 | bool PyObject_CheckFloat(PyObject* obj) { |
| 226 | if (PyFloat_Check(obj) || PyLong_Check(obj) || |
| 227 | (PyObject_CheckTensor(obj) && |
| 228 | reinterpret_cast<TensorObject*>(obj)->tensor.numel() == 1)) { |
| 229 | return true; |
| 230 | } |
| 231 | auto type_name = |
| 232 | std::string(reinterpret_cast<PyTypeObject*>(obj->ob_type)->tp_name); |
| 233 | VLOG(4) << "type_name: " << type_name; |
| 234 | if (type_name.find("numpy") != std::string::npos && |
| 235 | type_name.find("numpy.complex") == std::string::npos) { |
| 236 | return true; |
| 237 | } |
| 238 | return false; |
| 239 | } |
| 240 | |
| 241 | double PyObject_ToDouble(PyObject* obj) { |
| 242 | double res = 0.0; |
no test coverage detected