Skip to content

Commit

Permalink
fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwa committed Oct 26, 2023
1 parent 0920343 commit 1176706
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static py::object get_mockup_context_class() {
throw std::runtime_error("Fails to import the module.");
}

auto python_class = py::reinterpret_steal<py::object>(PyObject_GetAttrString(module, "FakeContext"));
auto python_class = py::reinterpret_steal<py::object>(PyObject_GetAttrString(module.ptr(), "FakeContext"));
if (!PyCallable_Check(python_class.ptr())) {
throw std::runtime_error("Cannot instantiate the Python class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

class FakeContext(object):

class FakeContext:
"""A mock up class used to represent ctx in unsfafe mode run.
The reason we need ctx to be Python class is: users could assign any attribute to ctx.
"""

def __init__(self):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

def torch_nvtx_range_push(msg):
if hasattr(torch.cuda.nvtx, "range_push"):
return torch.cuda.nvtx.range_push(msg)
torch.cuda.nvtx.range_push(msg)


def torch_nvtx_range_pop():
if hasattr(torch.cuda.nvtx, "range_pop"):
return torch.cuda.nvtx.range_pop()
torch.cuda.nvtx.range_pop()


def nvtx_function_decorator(func):
Expand Down

0 comments on commit 1176706

Please sign in to comment.