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

Function SetOpAttrWithDefaults

tensorflow/python/eager/pywrap_tfe_src.cc:673–698  ·  view source on GitHub ↗

This function will set the op attrs required. If an attr has the value of None, then it will read the AttrDef to get the default value and set that instead. Any failure in this function will simply fall back to the slow path.

Source from the content-addressed store, hash-verified

671// instead. Any failure in this function will simply fall back to the slow
672// path.
673void SetOpAttrWithDefaults(
674 TFE_Context* ctx, TFE_Op* op, const tensorflow::OpDef::AttrDef& attr,
675 const char* attr_name, PyObject* attr_value,
676 tensorflow::gtl::FlatMap<string, tensorflow::int64>* attr_list_sizes,
677 TF_Status* status) {
678 unsigned char is_list = 0;
679 const TF_AttrType type = TFE_OpGetAttrType(op, attr_name, &is_list, status);
680 if (TF_GetCode(status) != TF_OK) return;
681 if (attr_value == Py_None) {
682 if (is_list != 0) {
683 SetOpAttrListDefault(ctx, op, attr, attr_name, type, attr_list_sizes,
684 status);
685 } else {
686 SetOpAttrScalarDefault(ctx, op, attr.default_value(), attr_name,
687 attr_list_sizes, status);
688 }
689 } else {
690 if (is_list != 0) {
691 SetOpAttrList(ctx, op, attr_name, attr_value, type, attr_list_sizes,
692 status);
693 } else {
694 SetOpAttrScalar(ctx, op, attr_name, attr_value, type, attr_list_sizes,
695 status);
696 }
697 }
698}
699
700PyObject* GetPythonObjectFromInt(int num) {
701#if PY_MAJOR_VERSION >= 3

Callers 1

TFE_Py_FastPathExecute_CFunction · 0.85

Calls 7

TFE_OpGetAttrTypeFunction · 0.85
TF_GetCodeFunction · 0.85
SetOpAttrListDefaultFunction · 0.85
SetOpAttrScalarDefaultFunction · 0.85
SetOpAttrListFunction · 0.85
SetOpAttrScalarFunction · 0.85
default_valueMethod · 0.45

Tested by

no test coverage detected