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

Function QrShapeFn

tensorflow/core/ops/linalg_ops.cc:141–164  ·  view source on GitHub ↗

Input is [...,M,N]. First and second outputs are: [...,M,M]; [...,M,N], if full_matrices is true, [...,M,P]; [...,P,N], if full_matrices is false, where P = min(M,N).

Source from the content-addressed store, hash-verified

139// [...,M,P]; [...,P,N], if full_matrices is false,
140// where P = min(M,N).
141Status QrShapeFn(InferenceContext* c) {
142 ShapeHandle input;
143 TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(0), 2, &input));
144 DimensionHandle m = c->Dim(input, -2);
145 DimensionHandle n = c->Dim(input, -1);
146 DimensionHandle p;
147 TF_RETURN_IF_ERROR(c->Min(m, n, &p));
148 ShapeHandle batch_shape;
149 TF_RETURN_IF_ERROR(c->Subshape(input, 0, -2, &batch_shape));
150 ShapeHandle q_shape;
151 ShapeHandle r_shape;
152 bool full_matrices;
153 TF_RETURN_IF_ERROR(c->GetAttr("full_matrices", &full_matrices));
154 if (full_matrices) {
155 TF_RETURN_IF_ERROR(c->Concatenate(batch_shape, c->Matrix(m, m), &q_shape));
156 TF_RETURN_IF_ERROR(c->Concatenate(batch_shape, c->Matrix(m, n), &r_shape));
157 } else {
158 TF_RETURN_IF_ERROR(c->Concatenate(batch_shape, c->Matrix(m, p), &q_shape));
159 TF_RETURN_IF_ERROR(c->Concatenate(batch_shape, c->Matrix(p, n), &r_shape));
160 }
161 c->set_output(0, q_shape);
162 c->set_output(1, r_shape);
163 return Status::OK();
164}
165
166// Input is [...,M,N]. First output is [...,min(M,N)].
167// Second and third outputs are:

Callers

nothing calls this directly

Calls 9

WithRankAtLeastMethod · 0.80
SubshapeMethod · 0.80
MatrixMethod · 0.80
inputMethod · 0.45
DimMethod · 0.45
MinMethod · 0.45
GetAttrMethod · 0.45
ConcatenateMethod · 0.45
set_outputMethod · 0.45

Tested by

no test coverage detected