| 719 | ResourceApplyCenteredRMSProp); |
| 720 | |
| 721 | void CompileFtrl(XlaOpKernelContext* ctx, DataType dtype, |
| 722 | bool has_l2_shrinkage) { |
| 723 | xla::XlaBuilder* b = ctx->builder(); |
| 724 | |
| 725 | TensorShape var_shape, accum_shape, linear_shape; |
| 726 | xla::XlaOp var, accum, linear; |
| 727 | OP_REQUIRES_OK(ctx, ctx->ReadVariableInput(0, dtype, &var_shape, &var)); |
| 728 | OP_REQUIRES_OK(ctx, ctx->ReadVariableInput(1, dtype, &accum_shape, &accum)); |
| 729 | OP_REQUIRES_OK(ctx, ctx->ReadVariableInput(2, dtype, &linear_shape, &linear)); |
| 730 | |
| 731 | OP_REQUIRES(ctx, var_shape.IsSameSize(accum_shape), |
| 732 | errors::InvalidArgument( |
| 733 | "var and accum do not have the same shape", |
| 734 | var_shape.DebugString(), " ", accum_shape.DebugString())); |
| 735 | |
| 736 | OP_REQUIRES(ctx, var_shape.IsSameSize(linear_shape), |
| 737 | errors::InvalidArgument( |
| 738 | "var and linear do not have the same shape", |
| 739 | var_shape.DebugString(), " ", linear_shape.DebugString())); |
| 740 | |
| 741 | TensorShape grad_shape = ctx->InputShape(3); |
| 742 | TensorShape lr_shape = ctx->InputShape(4); |
| 743 | TensorShape l1_shape = ctx->InputShape(5); |
| 744 | TensorShape l2_shape = ctx->InputShape(6); |
| 745 | TensorShape l2_shrinkage_shape; |
| 746 | TensorShape lr_power_shape; |
| 747 | if (has_l2_shrinkage) { |
| 748 | l2_shrinkage_shape = ctx->InputShape(7); |
| 749 | lr_power_shape = ctx->InputShape(8); |
| 750 | } else { |
| 751 | lr_power_shape = ctx->InputShape(7); |
| 752 | } |
| 753 | |
| 754 | OP_REQUIRES(ctx, var_shape.IsSameSize(grad_shape), |
| 755 | errors::InvalidArgument("var and grad do not have the same shape", |
| 756 | var_shape.DebugString(), " ", |
| 757 | grad_shape.DebugString())); |
| 758 | |
| 759 | OP_REQUIRES( |
| 760 | ctx, TensorShapeUtils::IsScalar(lr_shape), |
| 761 | errors::InvalidArgument("lr is not a scalar: ", lr_shape.DebugString())); |
| 762 | |
| 763 | OP_REQUIRES( |
| 764 | ctx, TensorShapeUtils::IsScalar(l1_shape), |
| 765 | errors::InvalidArgument("l1 is not a scalar: ", l1_shape.DebugString())); |
| 766 | |
| 767 | OP_REQUIRES( |
| 768 | ctx, TensorShapeUtils::IsScalar(l2_shape), |
| 769 | errors::InvalidArgument("l2 is not a scalar: ", l2_shape.DebugString())); |
| 770 | |
| 771 | if (has_l2_shrinkage) { |
| 772 | OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(l2_shrinkage_shape), |
| 773 | errors::InvalidArgument("l2_shrinkage is not a scalar: ", |
| 774 | l2_shrinkage_shape.DebugString())); |
| 775 | } |
| 776 | |
| 777 | OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(lr_power_shape), |
| 778 | errors::InvalidArgument("lr_power is not a scalar: ", |
no test coverage detected