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

Method NumElements

tensorflow/python/eager/pywrap_tfe_src.cc:1042–1057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040 }
1041
1042 tensorflow::int64 NumElements(PyObject* tensor) const final {
1043 if (EagerTensor_CheckExact(tensor)) {
1044 return PyEagerTensor_NumElements(tensor);
1045 }
1046 PyObject* arglist =
1047 Py_BuildValue("(O)", reinterpret_cast<PyObject*>(tensor));
1048 PyObject* result = PyEval_CallObject(num_elements_, arglist);
1049 Py_DECREF(arglist);
1050 if (result == nullptr) {
1051 // The caller detects whether a python exception has been raised.
1052 return -1;
1053 }
1054 tensorflow::int64 r = MakeInt(result);
1055 Py_DECREF(result);
1056 return r;
1057 }
1058
1059 PyObject* AggregateGradients(
1060 tensorflow::gtl::ArraySlice<PyObject*> gradient_tensors) const final {

Callers

nothing calls this directly

Calls 2

MakeIntFunction · 0.85

Tested by

no test coverage detected