| 263 | } |
| 264 | |
| 265 | std::vector<int64> ShapeProtoToVec(const TensorShapeProto& shape_pb) { |
| 266 | std::vector<int64> shape_vec; |
| 267 | if (shape_pb.dim_size() == 0 && !shape_pb.unknown_rank()) { |
| 268 | // Scalar parameter with empty shape but known rank. |
| 269 | shape_vec.push_back(1); |
| 270 | } else { |
| 271 | for (const auto& d : shape_pb.dim()) { |
| 272 | shape_vec.push_back(d.size()); |
| 273 | } |
| 274 | } |
| 275 | return shape_vec; |
| 276 | } |
| 277 | |
| 278 | TensorShapeProto VecToShapeProto(const std::vector<int64>& shape_vec) { |
| 279 | TensorShapeProto shape_pb; |
no test coverage detected