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

Function ConvertOneUint64

tensorflow/python/lib/core/py_seq_tensor.cc:320–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318DEFINE_HELPER(ConvertInt64, int64, DT_INT64, ConvertOneInt64);
319
320const char* ConvertOneUint64(PyObject* v, uint64* out) {
321#if PY_MAJOR_VERSION < 3
322 if (TF_PREDICT_TRUE(PyInt_Check(v))) {
323 *out = PyInt_AsUnsignedLongLongMask(v);
324 return nullptr;
325 }
326#endif
327 if (TF_PREDICT_TRUE(PyLong_Check(v) || IsPyDimension(v))) {
328 *out = PyLong_AsUnsignedLongLong(v);
329 return nullptr;
330 }
331 if (PyIsInstance(v, &PyIntegerArrType_Type)) { // NumPy integers
332#if PY_MAJOR_VERSION < 3
333 Safe_PyObjectPtr as_int = make_safe(PyNumber_Int(v));
334#else
335 Safe_PyObjectPtr as_int = make_safe(PyNumber_Long(v));
336#endif
337 return ConvertOneUint64(as_int.get(), out);
338 }
339 if (IsPyFloat(v)) return ErrorFoundFloat;
340 return ErrorMixedTypes;
341}
342
343DEFINE_HELPER(ConvertUint64, uint64, DT_UINT64, ConvertOneUint64);
344

Callers

nothing calls this directly

Calls 5

IsPyDimensionFunction · 0.85
PyIsInstanceFunction · 0.85
IsPyFloatFunction · 0.85
make_safeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected