Skip to content

Commit

Permalink
[1/N] replace THPUtils_assert with TORCH_CHECK (pytorch#116675)
Browse files Browse the repository at this point in the history
This PR replaces THPUtils_assert with TORCH_CHECK.
Pull Request resolved: pytorch#116675
Approved by: https://github.com/albanD
  • Loading branch information
cyyever authored and pytorchmergebot committed Jan 4, 2024
1 parent faea6f2 commit 91bbcf8
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 207 deletions.
8 changes: 4 additions & 4 deletions torch/csrc/Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ static PyObject* THPGenerator_manualSeed(PyObject* _self, PyObject* seed) {
HANDLE_TH_ERRORS
auto self = (THPGenerator*)_self;
auto generator = self->cdata;
THPUtils_assert(
TORCH_CHECK(
THPUtils_checkLong(seed),
"manual_seed expected a long, "
"but got %s",
"but got ",
THPUtils_typename(seed));
uint64_t unsigned_seed = unpack_uint64(seed);
// See Note [Acquire lock when using random generators]
Expand All @@ -165,10 +165,10 @@ static PyObject* THPGenerator_setOffset(PyObject* _self, PyObject* offset) {
HANDLE_TH_ERRORS
auto self = (THPGenerator*)_self;
auto generator = self->cdata;
THPUtils_assert(
TORCH_CHECK(
THPUtils_checkLong(offset),
"manual_offset expected a long, "
"but got %s",
"but got ",
THPUtils_typename(offset));
uint64_t unsigned_offset = unpack_uint64(offset);
// See Note [Acquire lock when using random generators]
Expand Down
Loading

0 comments on commit 91bbcf8

Please sign in to comment.