MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsInstanceOfRegisteredType

Function IsInstanceOfRegisteredType

tensorflow/python/util/util.cc:198–211  ·  view source on GitHub ↗

Returns 1 if 'obj' is an instance of 'type_name' Returns 0 otherwise. Returns -1 if an error occurred (e.g., if 'type_name' is not registered.)

Source from the content-addressed store, hash-verified

196// Returns 0 otherwise.
197// Returns -1 if an error occurred (e.g., if 'type_name' is not registered.)
198int IsInstanceOfRegisteredType(PyObject* obj, const char* type_name) {
199 PyObject* type_obj = GetRegisteredType(type_name);
200 if (TF_PREDICT_FALSE(type_obj == nullptr)) {
201 PyErr_SetString(PyExc_RuntimeError,
202 tensorflow::strings::StrCat(
203 type_name,
204 " type has not been set. "
205 "Please register the type with the identifier \"",
206 type_name, "\" using RegisterType.")
207 .c_str());
208 return -1;
209 }
210 return PyObject_IsInstance(obj, type_obj);
211}
212
213// Returns 1 if `o` is considered a mapping for the purposes of Flatten().
214// Returns 0 otherwise.

Callers 10

IsMappingHelperFunction · 0.85
IsMappingViewHelperFunction · 0.85
IsIndexedSlicesHelperFunction · 0.85
IsTensorHelperFunction · 0.85
IsResourceVariableHelperFunction · 0.85
IsVariableHelperFunction · 0.85
IsSequenceHelperFunction · 0.85
IsCompositeTensorHelperFunction · 0.85
IsTypeSpecHelperFunction · 0.85
IsNamedtupleFunction · 0.85

Calls 3

GetRegisteredTypeFunction · 0.85
c_strMethod · 0.80
StrCatFunction · 0.50

Tested by

no test coverage detected