Skip to content
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

Support Half/BFloat16 in any #7769

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions kernels/portable/cpu/op_any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Tensor& any_all_out(KernelRuntimeContext& ctx, const Tensor& in, Tensor& out) {
ScalarType out_type = out.scalar_type();
constexpr auto name = "any.all_out";

ET_SWITCH_REALHB_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_REALHBBF16_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_TWO_TYPES(Bool, Byte, out_type, ctx, name, CTYPE_OUT, [&] {
const auto data_in = in.const_data_ptr<CTYPE_IN>();
auto data_out = out.mutable_data_ptr<CTYPE_OUT>();
Expand Down Expand Up @@ -78,7 +78,7 @@ Tensor& any_dims_out(
ScalarType out_type = out.scalar_type();
constexpr auto name = "any.dims_out";

ET_SWITCH_REALHB_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_REALHBBF16_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_TWO_TYPES(Bool, Byte, out_type, ctx, name, CTYPE_OUT, [&] {
CTYPE_OUT* out_data = out.mutable_data_ptr<CTYPE_OUT>();
if (dim_list.has_value() && dim_list.value().empty()) {
Expand Down Expand Up @@ -135,7 +135,7 @@ Tensor& any_out(
ScalarType out_type = out.scalar_type();
constexpr auto name = "any.out";

ET_SWITCH_REALHB_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_REALHBBF16_TYPES(in_type, ctx, name, CTYPE_IN, [&] {
ET_SWITCH_TWO_TYPES(Bool, Byte, out_type, ctx, name, CTYPE_OUT, [&] {
CTYPE_OUT* out_data = out.mutable_data_ptr<CTYPE_OUT>();
for (size_t out_ix = 0; out_ix < out.numel(); ++out_ix) {
Expand Down
2 changes: 1 addition & 1 deletion kernels/test/op_any_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST_F(OpAnyOutTest, InvalidDtypeDies) {

TEST_F(OpAnyOutTest, AllRealInputTypePasses) {
#define TEST_ENTRY(ctype, dtype) test_any_all_out<ScalarType::dtype>();
ET_FORALL_REAL_TYPES(TEST_ENTRY);
ET_FORALL_REALHBBF16_TYPES(TEST_ENTRY);
#undef TEST_ENTRY
}

Expand Down
Loading