Helper method that creates a shape handle for a shape described by dims.
| 259 | |
| 260 | // Helper method that creates a shape handle for a shape described by dims. |
| 261 | tensorflow::shape_inference::ShapeHandle ShapeHandleFromDims( |
| 262 | tensorflow::shape_inference::InferenceContext* ic, int num_dims, |
| 263 | const int64_t* dims) { |
| 264 | if (num_dims != -1) { |
| 265 | std::vector<tensorflow::shape_inference::DimensionHandle> dim_vec; |
| 266 | dim_vec.reserve(num_dims); |
| 267 | for (int i = 0; i < num_dims; ++i) { |
| 268 | dim_vec.push_back(ic->MakeDim(dims[i])); |
| 269 | } |
| 270 | return ic->MakeShape(dim_vec); |
| 271 | } else { |
| 272 | return ic->UnknownShape(); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | } // namespace |
| 277 |
no test coverage detected