| 867 | } |
| 868 | |
| 869 | TF_CAPI_EXPORT extern int TFE_OpGetOutputLength(TFE_Op* op, |
| 870 | const char* output_name, |
| 871 | TF_Status* status) { |
| 872 | const tensorflow::OpDef* op_def = GetOpDef(op, status); |
| 873 | if (!status->status.ok()) { |
| 874 | return -1; |
| 875 | } |
| 876 | tensorflow::AttrValueMap attrs; |
| 877 | op->operation.Attrs().FillAttrValueMap(&attrs); |
| 878 | tensorflow::NameRangeMap name_ranges; |
| 879 | status->status = tensorflow::NameRangesForNode( |
| 880 | tensorflow::AttrSlice(&attrs), *op_def, nullptr, &name_ranges); |
| 881 | if (!status->status.ok()) { |
| 882 | return -1; |
| 883 | } |
| 884 | auto iter = name_ranges.find(output_name); |
| 885 | if (iter == name_ranges.end()) { |
| 886 | status->status = tensorflow::errors::InvalidArgument( |
| 887 | "Output '", output_name, "' not found"); |
| 888 | return -1; |
| 889 | } |
| 890 | return iter->second.second - iter->second.first; |
| 891 | } |
| 892 | |
| 893 | void TFE_Execute(TFE_Op* op, TFE_TensorHandle** retvals, int* num_retvals, |
| 894 | TF_Status* status) { |