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

Method SetResultLayout

tensorflow/compiler/xla/service/layout_assignment.cc:271–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271Status LayoutConstraints::SetResultLayout(const Shape& shape_with_layout,
272 bool dfs) {
273 VLOG(3) << "SetResultLayout : "
274 << ShapeUtil::HumanStringWithLayout(shape_with_layout);
275
276 const ShapeLayout* curr_shape_layout = ResultLayout();
277 if (curr_shape_layout != nullptr) {
278 if (!curr_shape_layout->MatchesLayoutInShape(
279 shape_with_layout, /*minor_to_major_only=*/true)) {
280 return FailedPrecondition(
281 "Result of computation %s already has the layout constraint %s, "
282 "cannot add incompatible constraint %s",
283 computation_->name(), curr_shape_layout->ToString(),
284 ShapeUtil::HumanStringWithLayout(shape_with_layout));
285 }
286 // New constraint matches existing constraint. Nothing to do.
287 return Status::OK();
288 }
289 result_constraint_.reset(
290 new ResultLayoutConstraint(ShapeLayout(shape_with_layout), dfs));
291 added_constraints_.push_back(result_constraint_.get());
292
293 return Status::OK();
294}
295
296Status LayoutConstraints::SetInstructionLayout(
297 const Shape& shape_with_layout, const HloInstruction* instruction,

Callers 1

Calls 8

FailedPreconditionFunction · 0.85
ShapeLayoutClass · 0.85
MatchesLayoutInShapeMethod · 0.80
nameMethod · 0.65
ToStringMethod · 0.45
resetMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected