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

Method BuildTensorShapeBase

tensorflow/core/framework/tensor_shape.cc:136–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134
135template <class Shape>
136Status TensorShapeBase<Shape>::BuildTensorShapeBase(
137 const TensorShapeProto& proto, TensorShapeBase* out) {
138 out->set_tag(REP16);
139 out->set_data_type(DT_INVALID);
140 // NOTE(irving): Unfortunately, TensorShape allows parsing protos with
141 // unknown_shape() set, and it seems hard to remove this without backwards
142 // compatibility issues.
143 if (kIsPartial && proto.unknown_rank()) {
144 out->set_ndims_byte(kUnknownRank);
145 out->set_num_elements(-1);
146 } else {
147 out->set_ndims_byte(0);
148 out->set_num_elements(1);
149 Status s = Status::OK();
150 for (const auto& d : proto.dim()) {
151 s = out->AddDimWithStatus(d.size());
152 if (!s.ok()) {
153 return s;
154 }
155 }
156 }
157 return Status::OK();
158}
159
160template <class Shape>
161TensorShapeBase<Shape>::TensorShapeBase(gtl::ArraySlice<int64> dim_sizes) {

Callers

nothing calls this directly

Calls 10

set_tagMethod · 0.80
unknown_rankMethod · 0.80
set_ndims_byteMethod · 0.80
set_num_elementsMethod · 0.80
AddDimWithStatusMethod · 0.80
InitDimsMethod · 0.80
set_data_typeMethod · 0.45
dimMethod · 0.45
sizeMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected