MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / VerifyHandleData

Function VerifyHandleData

tensorflow/core/ops/list_ops.cc:25–43  ·  view source on GitHub ↗

Verifies that `shapes_and_types` is a valid list handle and has the right dtype.

Source from the content-addressed store, hash-verified

23// Verifies that `shapes_and_types` is a valid list handle and has the right
24// dtype.
25Status 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.
46shape_inference::ShapeHandle GetElementShapeFromHandleData(

Callers 1

list_ops.ccFile · 0.85

Calls 3

InvalidArgumentFunction · 0.85
DataTypeStringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected