Returns 1 if `o` is an instance of TypeSpec, but is not TensorSpec. Returns 0 otherwise. Returns -1 if an error occurred.
| 504 | // Returns 0 otherwise. |
| 505 | // Returns -1 if an error occurred. |
| 506 | bool IsTypeSpecHelper(PyObject* o) { |
| 507 | static auto* const check_cache = new CachedTypeCheck([](PyObject* to_check) { |
| 508 | int is_type_spec = IsInstanceOfRegisteredType(to_check, "TypeSpec"); |
| 509 | int is_tensor_spec = IsInstanceOfRegisteredType(to_check, "TensorSpec"); |
| 510 | if ((is_type_spec == -1) || (is_tensor_spec == -1)) return -1; |
| 511 | return static_cast<int>(is_type_spec && !is_tensor_spec); |
| 512 | }); |
| 513 | return check_cache->CachedLookup(o); |
| 514 | } |
| 515 | |
| 516 | // Returns 1 if `o` is a (non-string) sequence or CompositeTensor or |
| 517 | // (non-TensorSpec) TypeSpec. |
no test coverage detected