Skip to content

Commit

Permalink
Fixed incorrect uses of CATCH_RETURN_RES() C++ macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasGustafsson committed Feb 17, 2023
1 parent c60b807 commit 35dbb1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Native/LibTorchSharp/THSTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ Tensor THSTensor_repeat_interleave_int64(const Tensor tensor, const int64_t repe

int THSTensor_result_type(const Tensor left, const Tensor right)
{
CATCH_RETURN_RES(int, -1, (int)torch::result_type(*left, *right));
CATCH_RETURN_RES(int, -1, res = (int)torch::result_type(*left, *right));
}

Tensor THSTensor_movedim(const Tensor tensor, const int64_t* src, const int src_len, const int64_t* dst, const int dst_len)
Expand Down
8 changes: 4 additions & 4 deletions src/Native/LibTorchSharp/THSTorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const char * THSTorch_get_and_reset_last_err()

int THSTorch_get_num_threads()
{
CATCH_RETURN_RES(int, -1, torch::get_num_threads());
CATCH_RETURN_RES(int, -1, res = torch::get_num_threads());
}

void THSTorch_set_num_threads(const int threads)
Expand All @@ -163,7 +163,7 @@ void THSTorch_set_num_threads(const int threads)

int THSTorch_get_num_interop_threads()
{
CATCH_RETURN_RES(int, -1, torch::get_num_interop_threads());
CATCH_RETURN_RES(int, -1, res = torch::get_num_interop_threads());
}

void THSTorch_set_num_interop_threads(const int threads)
Expand All @@ -173,12 +173,12 @@ void THSTorch_set_num_interop_threads(const int threads)

int THSTorch_can_cast(const int type1, const int type2)
{
CATCH_RETURN_RES(int, -1, (int)torch::can_cast((c10::ScalarType)type1, (c10::ScalarType)type2));
CATCH_RETURN_RES(int, -1, res = (int)torch::can_cast((c10::ScalarType)type1, (c10::ScalarType)type2));
}

int THSTorch_promote_types(const int type1, const int type2)
{
CATCH_RETURN_RES(int, -1, (int)torch::promote_types((c10::ScalarType)type1, (c10::ScalarType)type2));
CATCH_RETURN_RES(int, -1, res = (int)torch::promote_types((c10::ScalarType)type1, (c10::ScalarType)type2));
}


Expand Down

0 comments on commit 35dbb1b

Please sign in to comment.