Skip to content

Commit

Permalink
Revert "repeat_interleave support bf16 dtype (PaddlePaddle#61854) (Pa…
Browse files Browse the repository at this point in the history
…ddlePaddle#61899)"

This reverts commit 96c2aaf.
  • Loading branch information
hanhaowen-mt committed May 13, 2024
1 parent b78d1b0 commit b17e2bc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 35 deletions.
6 changes: 2 additions & 4 deletions paddle/phi/kernels/cpu/repeat_interleave_grad_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index_grad,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}

PD_REGISTER_KERNEL(repeat_interleave_grad,
CPU,
Expand All @@ -114,5 +113,4 @@ PD_REGISTER_KERNEL(repeat_interleave_grad,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}
6 changes: 2 additions & 4 deletions paddle/phi/kernels/cpu/repeat_interleave_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ PD_REGISTER_KERNEL(repeat_interleave,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}

PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index,
CPU,
Expand All @@ -35,5 +34,4 @@ PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}
6 changes: 2 additions & 4 deletions paddle/phi/kernels/gpu/repeat_interleave_grad_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index_grad,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}
PD_REGISTER_KERNEL(repeat_interleave_grad,
GPU,
ALL_LAYOUT,
phi::RepeatInterleaveGradKernel,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}
6 changes: 2 additions & 4 deletions paddle/phi/kernels/gpu/repeat_interleave_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ PD_REGISTER_KERNEL(repeat_interleave,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}

PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index,
GPU,
Expand All @@ -35,5 +34,4 @@ PD_REGISTER_KERNEL(repeat_interleave_with_tensor_index,
float,
double,
int,
int64_t,
phi::dtype::bfloat16) {}
int64_t) {}
19 changes: 0 additions & 19 deletions test/legacy_test/test_repeat_interleave_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,6 @@ def test_dygraph_api(self):
expect_out = np.repeat(input_x, index, axis=None)
np.testing.assert_allclose(expect_out, np_z, rtol=1e-05)

# case input dtype is bfloat16
input_x = np.array([[1, 2, 1], [1, 2, 3]]).astype('uint16')

with base.dygraph.guard():
x = paddle.to_tensor(input_x)
index = paddle.to_tensor(index_x)
z = paddle.repeat_interleave(x, index, None)
np_z = z.numpy()
expect_out = np.repeat(input_x, index_x, axis=None)
np.testing.assert_allclose(expect_out, np_z, rtol=1e-05)

with base.dygraph.guard():
x = paddle.to_tensor(input_x)
index = 2
z = paddle.repeat_interleave(x, index, None)
np_z = z.numpy()
expect_out = np.repeat(input_x, index, axis=None)
np.testing.assert_allclose(expect_out, np_z, rtol=1e-05)

# case 1:
with base.dygraph.guard():
x = base.dygraph.to_variable(self.data_x)
Expand Down

0 comments on commit b17e2bc

Please sign in to comment.