| 478 | return Maybe<void>::Ok(); |
| 479 | } |
| 480 | Maybe<void> InferLarsUpdateTensorDesc(user_op::InferContext* ctx) { |
| 481 | const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 0); |
| 482 | |
| 483 | const Shape& shape = model.shape(); |
| 484 | const user_op::TensorDesc& model_diff = ctx->InputTensorDesc("model_diff", 0); |
| 485 | CHECK_EQ_OR_RETURN(model_diff.shape(), shape); |
| 486 | const user_op::TensorDesc& momentum = ctx->InputTensorDesc("momentum", 0); |
| 487 | JUST(CheckShapeLike(&momentum, &model)); |
| 488 | JUST(CheckLearningRateShape(ctx)); |
| 489 | if (ctx->has_input("scale_by_tensor", 0)) { |
| 490 | const auto& scale_by_tensor = ctx->InputTensorDesc("scale_by_tensor", 0); |
| 491 | JUST(CheckScalarShape(&scale_by_tensor)); |
| 492 | } |
| 493 | return Maybe<void>::Ok(); |
| 494 | } |
| 495 | Maybe<void> InferLarsUpdateDataType(user_op::InferContext* ctx) { |
| 496 | const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 0); |
| 497 | const user_op::TensorDesc& momentum = ctx->InputTensorDesc("momentum", 0); |
no test coverage detected