Skip to content

Commit a561e31

Browse files
swolchokYIWENX14
authored andcommitted
Support Half/BFloat16 in ones (#7851)
Partial fix for #7748.
1 parent 58054e3 commit a561e31

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kernels/portable/cpu/op_ones.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Tensor& ones_out(KernelRuntimeContext& ctx, IntArrayRef size, Tensor& out) {
2020
ctx, resize_tensor(out, size) == Error::Ok, InvalidArgument, out);
2121

2222
ScalarType out_type = out.scalar_type();
23-
ET_SWITCH_REAL_TYPES_AND(Bool, out_type, ctx, __func__, CTYPE, [&] {
23+
ET_SWITCH_REALHBBF16_TYPES(out_type, ctx, __func__, CTYPE, [&] {
2424
auto out_data = out.mutable_data_ptr<CTYPE>();
2525
for (size_t i = 0; i < out.numel(); i++) {
2626
out_data[i] = static_cast<CTYPE>(1);

kernels/test/op_ones_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ class OpOnesOutTest : public OperatorTest {
5151
test_ones_out<ScalarType::DTYPE>({2, 3, 4}); \
5252
}
5353

54-
ET_FORALL_REAL_TYPES_AND(Bool, GENERATE_TEST)
54+
ET_FORALL_REALHBBF16_TYPES(GENERATE_TEST)

0 commit comments

Comments
 (0)