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

Method Relax

tensorflow/core/framework/shape_inference.cc:439–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437}
438
439void InferenceContext::Relax(DimensionHandle d_old, DimensionHandle d_new,
440 DimensionHandle* out) {
441 if (d_old.SameHandle(d_new)) {
442 *out = d_old;
443 } else if (!ValueKnown(d_old) && !ValueKnown(d_new)) {
444 // The node will be fed by the dimension d_new instead of d_old: any
445 // equality assertion between d_old and other input dimension on this node
446 // may not be true anymore, so forget them all.
447 ForgetMerges();
448 // Return the new shape handle to force the relaxation to propagate to the
449 // fanout of the context.
450 *out = d_new;
451 } else if (!ValueKnown(d_new)) {
452 ForgetMerges();
453 *out = d_new;
454 } else if (Value(d_old) == Value(d_new)) {
455 // Return the old shape handle. This will stop the relaxation in the fanout
456 // of the context.
457 *out = d_old;
458 } else {
459 // Return a new handle that encodes a different unknown dim.
460 ForgetMerges();
461 *out = UnknownDim();
462 }
463}
464
465Status InferenceContext::Merge(DimensionHandle d0, DimensionHandle d1,
466 DimensionHandle* out) {

Callers

nothing calls this directly

Calls 6

MakeShapeFunction · 0.85
ValueClass · 0.70
UnknownShapeFunction · 0.70
RankFunction · 0.50
SameHandleMethod · 0.45
IsSetMethod · 0.45

Tested by

no test coverage detected