| 183 | } |
| 184 | |
| 185 | Maybe<void> InferAdamUpdateTensorDesc(user_op::InferContext* ctx) { |
| 186 | const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 0); |
| 187 | const Shape& shape = model.shape(); |
| 188 | const user_op::TensorDesc& model_diff = ctx->InputTensorDesc("model_diff", 0); |
| 189 | CHECK_EQ_OR_RETURN(model_diff.shape(), shape); |
| 190 | const user_op::TensorDesc& m = ctx->InputTensorDesc("m", 0); |
| 191 | JUST(CheckShapeLike(&m, &model)); |
| 192 | const user_op::TensorDesc& v = ctx->InputTensorDesc("v", 0); |
| 193 | JUST(CheckShapeLike(&v, &model)); |
| 194 | JUST(CheckLearningRateShape(ctx)); |
| 195 | if (ctx->has_input("model_copy", 0)) { |
| 196 | CHECK_EQ_OR_RETURN(ctx->InputTensorDesc("model_copy", 0).shape(), shape) |
| 197 | << "Model copy shape should be equal to Model shape. "; |
| 198 | } |
| 199 | if (ctx->has_input("scale_by_tensor", 0)) { |
| 200 | const auto& scale_by_tensor = ctx->InputTensorDesc("scale_by_tensor", 0); |
| 201 | JUST(CheckScalarShape(&scale_by_tensor)); |
| 202 | } |
| 203 | return Maybe<void>::Ok(); |
| 204 | } |
| 205 | Maybe<void> InferAdamUpdateDataType(user_op::InferContext* ctx) { |
| 206 | const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 0); |
| 207 | const user_op::TensorDesc& m = ctx->InputTensorDesc("m", 0); |
no test coverage detected