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).
| 139 | // [...,M,P]; [...,P,N], if full_matrices is false, |
| 140 | // where P = min(M,N). |
| 141 | Status 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: |
nothing calls this directly
no test coverage detected