| 57 | } |
| 58 | |
| 59 | static Status HandleKvGradAndIndicesInputs(InferenceContext* c, bool sparse, |
| 60 | int grad_idx, ShapeHandle* s) { |
| 61 | ShapeHandle grad = ShapeOrHandleShape(c, grad_idx); |
| 62 | if (!sparse) { |
| 63 | TF_RETURN_IF_ERROR(c->Merge(*s, grad, s)); |
| 64 | return Status::OK(); |
| 65 | } |
| 66 | // Indices is a vector where indices.dim[0].rank == grad[0].rank. |
| 67 | ShapeHandle indices; |
| 68 | TF_RETURN_IF_ERROR(c->WithRank(c->input(grad_idx + 1), 1, &indices)); |
| 69 | DimensionHandle unused; |
| 70 | TF_RETURN_IF_ERROR(c->Merge(c->Dim(indices, 0), c->Dim(grad, 0), &unused)); |
| 71 | |
| 72 | // Trailing part of grad matches trailing part of *s. |
| 73 | ShapeHandle grad_unknown_first; |
| 74 | TF_RETURN_IF_ERROR( |
| 75 | c->Subshape(grad, 1, &grad_unknown_first)); |
| 76 | TF_RETURN_IF_ERROR(c->Merge(*s, grad_unknown_first, s)); |
| 77 | |
| 78 | return Status::OK(); |
| 79 | } |
| 80 | |
| 81 | static Status KvResourceApplyAdagradShapeFn(InferenceContext* c, bool sparse) { |
| 82 | ShapeHandle unused; |
no test coverage detected