[MPS] Add StreamContext stub (#20782)
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
This commit is contained in:
@@ -69,6 +69,19 @@ class Event:
|
|||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
|
class StreamContext:
|
||||||
|
"""Minimal stand-in for ``torch.cuda.StreamContext``."""
|
||||||
|
|
||||||
|
def __init__(self, stream: Any = None) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __enter__(self) -> "StreamContext":
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, *args: Any) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
_default_stream = Stream()
|
_default_stream = Stream()
|
||||||
|
|
||||||
|
|
||||||
@@ -235,6 +248,7 @@ def install() -> None:
|
|||||||
# Only patch attributes that are actually missing
|
# Only patch attributes that are actually missing
|
||||||
for name, obj in [
|
for name, obj in [
|
||||||
("Stream", Stream),
|
("Stream", Stream),
|
||||||
|
("StreamContext", StreamContext),
|
||||||
("Event", Event),
|
("Event", Event),
|
||||||
("current_stream", current_stream),
|
("current_stream", current_stream),
|
||||||
("stream", stream),
|
("stream", stream),
|
||||||
|
|||||||
Reference in New Issue
Block a user