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

Method ShapeHandleToProto

tensorflow/core/framework/shape_inference.cc:287–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void InferenceContext::ShapeHandleToProto(ShapeHandle handle,
288 TensorShapeProto* proto) {
289 if (!RankKnown(handle)) {
290 proto->set_unknown_rank(true);
291 return;
292 }
293
294 for (int32 i = 0; i < Rank(handle); ++i) {
295 DimensionHandle dim = Dim(handle, i);
296 auto* dim_shape = proto->add_dim();
297 if (ValueKnown(dim)) {
298 dim_shape->set_size(Value(dim));
299 } else {
300 dim_shape->set_size(-1);
301 }
302 }
303}
304
305bool InferenceContext::FullyDefined(ShapeHandle s) {
306 if (!RankKnown(s)) return false;

Callers 6

TEST_FFunction · 0.80
UpdateFunctionMethod · 0.80
GetHandleShapeAndTypeFunction · 0.80

Calls 3

ValueClass · 0.70
RankFunction · 0.50
set_sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.64