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

Function EagerTensor_rank

tensorflow/python/eager/pywrap_tensor.cc:607–619  ·  view source on GitHub ↗

Getter for `_rank`.

Source from the content-addressed store, hash-verified

605
606// Getter for `_rank`.
607static PyObject* EagerTensor_rank(EagerTensor* self) {
608 int num_dims = TFE_TensorHandleNumDims(self->handle, self->status);
609 if (MaybeRaiseExceptionFromTFStatus(self->status, PyExc_ValueError)) {
610 // Cleanup self->status before returning.
611 TF_SetStatus(self->status, TF_OK, "");
612 return nullptr;
613 }
614#if PY_MAJOR_VERSION < 3
615 return PyInt_FromLong(num_dims);
616#else
617 return PyLong_FromLong(num_dims);
618#endif
619}
620
621// Getter for `_num_elements`.
622static PyObject* EagerTensor_num_elements(EagerTensor* self) {

Callers

nothing calls this directly

Calls 3

TFE_TensorHandleNumDimsFunction · 0.85
TF_SetStatusFunction · 0.85

Tested by

no test coverage detected