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

Function ValidateVariableResourceHandle

tensorflow/core/ops/hash_ops.cc:29–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace {
28
29Status ValidateVariableResourceHandle(InferenceContext* c,
30 ShapeAndType* shape_and_type) {
31 auto* handle_data = c->input_handle_shapes_and_types(0);
32 if (handle_data == nullptr || handle_data->empty()) {
33 shape_and_type->shape = c->UnknownShape();
34 shape_and_type->dtype = DT_INVALID;
35 } else {
36 *shape_and_type = (*handle_data)[0];
37 DataType value_dtype;
38 TF_RETURN_IF_ERROR(c->GetAttr("dtype", &value_dtype));
39 if (shape_and_type->dtype != value_dtype) {
40 return errors::InvalidArgument(
41 "Trying to read variable with wrong dtype. "
42 "Expected ",
43 DataTypeString(shape_and_type->dtype), " got ",
44 DataTypeString(value_dtype));
45 }
46 }
47 return Status::OK();
48}
49
50} // namesapce
51

Callers 10

ReadVariableShapeFnFunction · 0.70
CreateAssignShapeFnFunction · 0.70
hash_ops.ccFile · 0.70
dense_fprop.ccFile · 0.50
sparse_fprop.ccFile · 0.50

Calls 6

InvalidArgumentFunction · 0.85
UnknownShapeMethod · 0.80
DataTypeStringFunction · 0.50
emptyMethod · 0.45
GetAttrMethod · 0.45

Tested by

no test coverage detected