Skip to content

Support Half/BFloat16 in tril #7893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernels/portable/cpu/op_tril.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Tensor& tril_out(
clear_out(out);

ScalarType out_type = out.scalar_type();
ET_SWITCH_REAL_TYPES_AND(Bool, out_type, ctx, __func__, CTYPE, [&]() {
ET_SWITCH_REALHBBF16_TYPES(out_type, ctx, __func__, CTYPE, [&]() {
tril_kernel<CTYPE>(ctx, self, diagonal, out);
});

Expand Down
4 changes: 2 additions & 2 deletions kernels/test/op_tril_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class OpTrilTest : public OperatorTest {
test_tril_out_multi_unequal_dim<ScalarType::DTYPE>(); \
}

ET_FORALL_REAL_TYPES_AND(Bool, GENERATE_GENERIC_TEST)
ET_FORALL_REALHBBF16_TYPES(GENERATE_GENERIC_TEST)

// Create generic tests for real dtypes. Tensors have diverse values.
#define GENERATE_REAL_TEST(_, DTYPE) \
Expand All @@ -738,7 +738,7 @@ ET_FORALL_REAL_TYPES_AND(Bool, GENERATE_GENERIC_TEST)
test_tril_out_randint_multi_unequal<ScalarType::DTYPE>(); \
}

ET_FORALL_REAL_TYPES(GENERATE_REAL_TEST)
ET_FORALL_REALHBBF16_TYPES(GENERATE_REAL_TEST)

TEST_F(OpTrilTest, InvalidInputShapesDies) {
TensorFactory<ScalarType::Int> tf;
Expand Down
Loading