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

Function InferRmsPropUpdateTensorDesc

oneflow/user/ops/model_update_ops.cpp:440–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440Maybe<void> InferRmsPropUpdateTensorDesc(user_op::InferContext* ctx) {
441 const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 0);
442
443 const Shape& shape = model.shape();
444 const user_op::TensorDesc& model_diff = ctx->InputTensorDesc("model_diff", 0);
445 CHECK_EQ_OR_RETURN(model_diff.shape(), shape);
446 const user_op::TensorDesc& mean_square = ctx->InputTensorDesc("mean_square", 0);
447 JUST(CheckShapeLike(&mean_square, &model));
448 JUST(CheckLearningRateShape(ctx));
449 if (ctx->has_input("scale_by_tensor", 0)) {
450 const auto& scale_by_tensor = ctx->InputTensorDesc("scale_by_tensor", 0);
451 JUST(CheckScalarShape(&scale_by_tensor));
452 }
453 if (ctx->Attr<bool>("centered")) {
454 CHECK_OR_RETURN(ctx->has_input("mean_gradient", 0));
455 const user_op::TensorDesc& mean_gradient = ctx->InputTensorDesc("mean_gradient", 0);
456 JUST(CheckShapeLike(&mean_gradient, &model));
457 } else {
458 CHECK_OR_RETURN(!ctx->has_input("mean_gradient", 0));
459 }
460 return Maybe<void>::Ok();
461}
462
463Maybe<void> InferRmsPropUpdateDataType(user_op::InferContext* ctx) {
464 const user_op::TensorDesc& model = ctx->InputTensorDesc("model", 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