Skip to content

Commit 1fa927b

Browse files
dulinrileyfacebook-github-bot
authored andcommitted
Extend torch_to_executorch_scalar_type for uint16
Summary: The aten_bridge didn't have a way to map a torch.Tensor of uint16 into the Executorch Bits16 type. Added this for both round-trips. This is likely only relevant for users of the python bindings to Executorch. Differential Revision: D65681731
1 parent ddc8ea6 commit 1fa927b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extension/aten_util/aten_bridge.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ torch::executor::ScalarType torch_to_executorch_scalar_type(
7171
return torch::executor::ScalarType::Char;
7272
case c10::ScalarType::Short:
7373
return torch::executor::ScalarType::Short;
74+
case c10::ScalarType::UInt16:
75+
return torch::executor::ScalarType::Bits16;
7476
case c10::ScalarType::Half:
7577
return torch::executor::ScalarType::Half;
7678
case c10::ScalarType::BFloat16:
@@ -103,6 +105,8 @@ c10::ScalarType executorch_to_torch_scalar_type(
103105
return c10::ScalarType::Char;
104106
case torch::executor::ScalarType::Short:
105107
return c10::ScalarType::Short;
108+
case torch::executor::ScalarType::Bits16:
109+
return c10::ScalarType::UInt16;
106110
case torch::executor::ScalarType::Half:
107111
return c10::ScalarType::Half;
108112
case torch::executor::ScalarType::BFloat16:

0 commit comments

Comments
 (0)