| 29 | namespace { |
| 30 | |
| 31 | std::vector<int64> TensorShapeAsVector(TFE_TensorHandle* handle, |
| 32 | TF_Status* status) { |
| 33 | std::vector<int64> shape; |
| 34 | int rank = TFE_TensorHandleNumDims(handle, status); |
| 35 | if (TF_GetCode(status) != TF_OK) { |
| 36 | return shape; |
| 37 | } |
| 38 | shape.reserve(rank); |
| 39 | for (int i = 0; i < rank; ++i) { |
| 40 | shape.push_back(TFE_TensorHandleDim(handle, i, status)); |
| 41 | if (TF_GetCode(status) != TF_OK) { |
| 42 | return shape; |
| 43 | } |
| 44 | } |
| 45 | return shape; |
| 46 | } |
| 47 | |
| 48 | } // namespace |
| 49 |
no test coverage detected