Skip to content

Commit ce7fafd

Browse files
mcr229facebook-github-bot
authored andcommitted
resize output tensor (#8714)
Summary: Optimized Gelu Kernel was failing to resize the output tensor, which was causing some issues later down the road. Reviewed By: digantdesai Differential Revision: D70218118
1 parent c6761f4 commit ce7fafd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernels/optimized/cpu/op_gelu.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ Tensor& opt_gelu_out(
9898
ET_KERNEL_CHECK(
9999
context, check_gelu_args(input, approximate, out), InvalidArgument, out);
100100

101+
ET_KERNEL_CHECK(
102+
context,
103+
resize_tensor(out, input.sizes()) == Error::Ok,
104+
InvalidArgument,
105+
out);
106+
101107
ET_SWITCH_FLOATHBF16_TYPES(
102108
input.scalar_type(), context, "gelu.out", CTYPE, [&]() {
103109
gelu<CTYPE>(context, input, approximate, out);

0 commit comments

Comments
 (0)