Created by: Aurelius84
This PR is mainly used to enhance checking registered data_type of new Op.
Here are some cases that would be not allowed:
- Only one data_type is registered of new op in PR.
// one of float, double, int, int64_t
REGISTER_OP_CPU_KERNEL(
expand_test_e, ops::ExpandKernel<paddle::platform::CPUDeviceContext, int>);
REGISTER_OP_CPU_KERNEL(
expand_test_e_grad,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int>);
- Only one of float/double(or int/int64_t) is registered of new op in PR.
// If you register int, the int64_t should be registered too.
REGISTER_OP_CPU_KERNEL(
expand_test_e, ops::ExpandKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, float>);
REGISTER_OP_CPU_KERNEL(
expand_test_e_grad,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, float>);
However, the followed case is allowed:
// It looks good, because all needed data_types are registered.
REGISTER_OP_CPU_KERNEL(
expand_test_e, ops::ExpandKernel<paddle::platform::CPUDeviceContext, float>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, double>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, int64_t>);
REGISTER_OP_CPU_KERNEL(
expand_test_e_grad,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, float>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, double>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int64_t>);
or
// It looks good, because both float and double are registered.
REGISTER_OP_CPU_KERNEL(
expand_test_e, ops::ExpandKernel<paddle::platform::CPUDeviceContext, float>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, double>);
REGISTER_OP_CPU_KERNEL(
expand_test_e_grad,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, float>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, double>);
or
// It looks good, because both int and int64_t are registered.
REGISTER_OP_CPU_KERNEL(
expand_test_e, ops::ExpandKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandKernel<paddle::platform::CPUDeviceContext, int64_t>);
REGISTER_OP_CPU_KERNEL(
expand_test_e_grad,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int>,
ops::ExpandGradKernel<paddle::platform::CPUDeviceContext, int64_t>);
For some special op, only one of float/double
and int/int64_t
is supported. You can request some specific reviewer to approve you PR.
Examples PR
- please see log of PR 21526 in details. In this PR, five new operators are added and their registered data_type as follows:
expand_test_a -> float int // not allowed
expand_test_b -> float double int // not allowed
expand_test_c -> float // not allowed
expand_test_d -> float double int int64_t
expand_test_e -> int int64_t
In above ops, expand_test_a、expand_test_b andexpand_test_c are illegal, so gives warnings in log and needs specific reviewer to approve.
The warnings info:
[Step 1/1] 0 . More data_type of new operator should be regitered in your PR. Please make sure that both float/double (or int/int64_t) have been regitered. You must have one RD (Aurelius84 or liym27 or zhhsplendid)approval for the data_type registration of new operator.
[03:56:30] [Step 1/1]
[03:56:30] [Step 1/1] There are 1 approved errors.
[03:56:30] [Step 1/1] ****************
[03:56:31] [Step 1/1] + expand_test_a float int
[03:56:31] [Step 1/1] + expand_test_b double float int
[03:56:31] [Step 1/1] + expand_test_c float
[03:56:39] [Step 1/1] Process exited with code 1
If these new ops only supporte one of float/double
and int/int64_t
. You can request some specific reviewer to approve you PR. In above PR 21526, if one of Aurelius84/lym27/zhhsplendid
approve it. The CI will pass and log looks like this in details.