Skip to content

Commit 4a63e34

Browse files
committed
fix lint
Signed-off-by: whx-sjtu <2952154980@qq.com>
1 parent 950af06 commit 4a63e34

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

vllm_ascend/utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,27 +619,30 @@ def weak_ref_tensors(
619619
raise ValueError("Invalid type for tensors")
620620

621621

622-
def npu_stream_switch(target_stream: torch.npu.Stream, *, enabled: bool = True):
622+
def npu_stream_switch(target_stream: torch.npu.Stream,
623+
*,
624+
enabled: bool = True):
623625
"""
624626
Switch to the target stream if enabled is True.
625627
Otherwise, do nothing.
626628
"""
627629
if not enabled:
628630
return nullcontext()
631+
assert target_stream is not None
629632
return torch.npu.stream(target_stream)
630633

631634

632-
def npu_wait_stream(
633-
current_stream: torch.npu.Stream,
634-
target_stream: torch.npu.Stream,
635-
*,
636-
enabled: bool = True
637-
):
635+
def npu_wait_stream(current_stream: torch.npu.Stream,
636+
target_stream: torch.npu.Stream,
637+
*,
638+
enabled: bool = True):
638639
"""
639640
Make current stream wait for the target stream if enabled is True.
640641
This operation will launch a record event on the target stream,
641642
and launch a wait event on current stream, waitint for the record event.
642643
Otherwise, do nothing.
643644
"""
644645
if enabled:
645-
current_stream.wait_stream(target_stream)
646+
assert current_stream is not None
647+
assert target_stream is not None
648+
current_stream.wait_stream(target_stream)

0 commit comments

Comments
 (0)