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

Method FromProto

tensorflow/core/framework/resource_handle.cc:54–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54Status ResourceHandle::FromProto(const ResourceHandleProto& proto) {
55 set_device(proto.device());
56 set_container(proto.container());
57 set_name(proto.name());
58 set_hash_code(proto.hash_code());
59 set_maybe_type_name(proto.maybe_type_name());
60 std::vector<DtypeAndPartialTensorShape> dtypes_and_shapes;
61 for (const auto& dtype_and_shape : proto.dtypes_and_shapes()) {
62 DataType dtype = dtype_and_shape.dtype();
63 PartialTensorShape shape;
64 Status s = PartialTensorShape::BuildPartialTensorShape(
65 dtype_and_shape.shape(), &shape);
66 if (!s.ok()) {
67 return s;
68 }
69 dtypes_and_shapes.push_back(DtypeAndPartialTensorShape{dtype, shape});
70 }
71 dtypes_and_shapes_ = std::move(dtypes_and_shapes);
72 return Status::OK();
73}
74
75string ResourceHandle::SerializeAsString() const {
76 ResourceHandleProto proto;

Callers 2

BuildResourceHandleMethod · 0.45
DecodeResourceHandleListFunction · 0.45

Calls 10

set_deviceFunction · 0.85
dtypes_and_shapesMethod · 0.80
nameMethod · 0.65
deviceMethod · 0.45
containerMethod · 0.45
hash_codeMethod · 0.45
dtypeMethod · 0.45
shapeMethod · 0.45
okMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected