Check whether updates.shape = indices.shape + params.shape[1:]
| 37 | |
| 38 | // Check whether updates.shape = indices.shape + params.shape[1:] |
| 39 | static bool ValidShapes(const Tensor& params, const Tensor& updates, |
| 40 | const Tensor& indices) { |
| 41 | if (updates.dims() == 0) return true; |
| 42 | if (updates.dims() != indices.dims() + params.dims() - 1) return false; |
| 43 | for (int d = 0; d < indices.dims(); d++) { |
| 44 | if (updates.dim_size(d) != indices.dim_size(d)) { |
| 45 | return false; |
| 46 | } |
| 47 | } |
| 48 | for (int d = 1; d < params.dims(); d++) { |
| 49 | if (params.dim_size(d) != updates.dim_size(d - 1 + indices.dims())) { |
| 50 | return false; |
| 51 | } |
| 52 | } |
| 53 | return true; |
| 54 | } |
| 55 | |
| 56 | static void DoValidationChecking(OpKernelContext* c, const Tensor& params, |
| 57 | const Tensor& indices, const Tensor& updates) { |
no test coverage detected