MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / InferLarsUpdateTensorDesc

Function InferLarsUpdateTensorDesc

oneflow/user/ops/model_update_ops.cpp:480–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478 return Maybe<void>::Ok();
479}
480Maybe<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}
495Maybe<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);

Callers 1

Calls 5

CheckShapeLikeFunction · 0.70
CheckLearningRateShapeFunction · 0.70
CheckScalarShapeFunction · 0.70
shapeMethod · 0.45
has_inputMethod · 0.45

Tested by

no test coverage detected