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

Function TFE_OpGetInputLength

tensorflow/c/eager/c_api.cc:845–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843}
844
845TF_CAPI_EXPORT extern int TFE_OpGetInputLength(TFE_Op* op,
846 const char* input_name,
847 TF_Status* status) {
848 const tensorflow::OpDef* op_def = GetOpDef(op, status);
849 if (!status->status.ok()) {
850 return -1;
851 }
852 tensorflow::AttrValueMap attrs;
853 op->operation.Attrs().FillAttrValueMap(&attrs);
854 tensorflow::NameRangeMap name_ranges;
855 status->status = tensorflow::NameRangesForNode(
856 tensorflow::AttrSlice(&attrs), *op_def, &name_ranges, nullptr);
857 if (!status->status.ok()) {
858 return -1;
859 }
860 auto iter = name_ranges.find(input_name);
861 if (iter == name_ranges.end()) {
862 status->status = tensorflow::errors::InvalidArgument("Input '", input_name,
863 "' not found");
864 return -1;
865 }
866 return iter->second.second - iter->second.first;
867}
868
869TF_CAPI_EXPORT extern int TFE_OpGetOutputLength(TFE_Op* op,
870 const char* output_name,

Callers 2

TESTFunction · 0.85

Calls 9

NameRangesForNodeFunction · 0.85
AttrSliceClass · 0.85
InvalidArgumentFunction · 0.85
GetOpDefFunction · 0.70
okMethod · 0.45
FillAttrValueMapMethod · 0.45
AttrsMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.68