Verifies that `shapes_and_types` is a valid list handle and has the right dtype.
| 23 | // Verifies that `shapes_and_types` is a valid list handle and has the right |
| 24 | // dtype. |
| 25 | Status VerifyHandleData( |
| 26 | shape_inference::InferenceContext* c, |
| 27 | const std::vector<shape_inference::ShapeAndType>& shapes_and_types, |
| 28 | DataType element_dtype) { |
| 29 | if (shapes_and_types.size() != 1) { |
| 30 | return errors::InvalidArgument( |
| 31 | "Invalid handle_data for input list. Expected length of " |
| 32 | "shape_and_types: ", |
| 33 | 1, " Saw: ", shapes_and_types.size()); |
| 34 | } |
| 35 | const shape_inference::ShapeAndType& list_shape_type = shapes_and_types[0]; |
| 36 | if (list_shape_type.dtype != element_dtype) { |
| 37 | return errors::InvalidArgument("Expected list with element dtype ", |
| 38 | DataTypeString(element_dtype), |
| 39 | " but got list with element dtype ", |
| 40 | DataTypeString(list_shape_type.dtype)); |
| 41 | } |
| 42 | return Status::OK(); |
| 43 | } |
| 44 | |
| 45 | // Assumes that the handle_data is valid. |
| 46 | shape_inference::ShapeHandle GetElementShapeFromHandleData( |
no test coverage detected