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

Function ParseDimensionValue

tensorflow/python/eager/pywrap_tfe_src.cc:189–212  ·  view source on GitHub ↗

This function considers a Dimension._value of None to be valid, and sets the value to be -1 in that case.

Source from the content-addressed store, hash-verified

187// This function considers a Dimension._value of None to be valid, and sets the
188// value to be -1 in that case.
189bool ParseDimensionValue(const string& key, PyObject* py_value,
190 TF_Status* status, int64_t* value) {
191 if (IsInteger(py_value)) {
192 return ParseInt64Value(key, py_value, status, value);
193 }
194
195 tensorflow::Safe_PyObjectPtr dimension_value(
196 PyObject_GetAttrString(py_value, "_value"));
197 if (dimension_value == nullptr) {
198 TF_SetStatus(
199 status, TF_INVALID_ARGUMENT,
200 tensorflow::strings::StrCat("Expecting a Dimension for attr ", key,
201 ", got ", py_value->ob_type->tp_name)
202 .c_str());
203 return false;
204 }
205
206 if (dimension_value.get() == Py_None) {
207 *value = -1;
208 return true;
209 }
210
211 return ParseInt64Value(key, dimension_value.get(), status, value);
212}
213
214bool ParseStringValue(const string& key, PyObject* py_value, TF_Status* status,
215 tensorflow::StringPiece* value) {

Callers 2

SetOpAttrListFunction · 0.85
SetOpAttrScalarFunction · 0.85

Calls 6

IsIntegerFunction · 0.85
ParseInt64ValueFunction · 0.85
TF_SetStatusFunction · 0.85
c_strMethod · 0.80
StrCatFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected