Skip to content

Commit 6b942e5

Browse files
committed
fix(//py): Fix bounds for enum macros
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 5031324 commit 6b942e5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: py/trtorch/csrc/tensorrt_classes.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ namespace pyapi {
1818
}
1919

2020
// TODO: Make this error message more informative
21-
#define ADD_ENUM_GET_SET(field_name, type, max_val) \
22-
void set_##field_name(int64_t val) { \
23-
TRTORCH_CHECK(val < max_val, "Invalid enum value for field"); \
24-
field_name = static_cast<type>(val); \
25-
} \
26-
int64_t get_##field_name() { \
27-
return static_cast<int64_t>(field_name); \
21+
#define ADD_ENUM_GET_SET(field_name, type, max_val) \
22+
void set_##field_name(int64_t val) { \
23+
TRTORCH_CHECK(val >= 0 && val <= max_val, "Invalid enum value for field"); \
24+
field_name = static_cast<type>(val); \
25+
} \
26+
int64_t get_##field_name() { \
27+
return static_cast<int64_t>(field_name); \
2828
}
2929

3030
struct InputRange : torch::CustomClassHolder {

0 commit comments

Comments
 (0)