mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Type torch._dynamo.side_effects (#90202)
Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/90202 Approved by: https://github.com/voznesenskym
This commit is contained in:
committed by
PyTorch MergeBot
parent
ca5f69ef19
commit
54d344b0b7
@ -159,6 +159,7 @@ include_patterns = [
|
||||
'torch/_dynamo/types.py',
|
||||
'torch/_dynamo/output_graph.py',
|
||||
'torch/_dynamo/guards.py',
|
||||
'torch/_dynamo/side_effects.py',
|
||||
'torch/_dynamo/optimizations/__init__.py',
|
||||
'torch/_dynamo/optimizations/backends.py',
|
||||
'torch/_dynamo/optimizations/training.py',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import collections
|
||||
import dataclasses
|
||||
import inspect
|
||||
from typing import Any
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import torch.nn
|
||||
|
||||
@ -59,14 +59,18 @@ class AttributeMutationNew(AttributeMutation):
|
||||
return self is other
|
||||
|
||||
|
||||
class SideEffects(object):
|
||||
class SideEffects:
|
||||
"""
|
||||
Track side effects (list mutation, setattr, etc) that need to be
|
||||
applied after an FX graph is run.
|
||||
"""
|
||||
|
||||
id_to_variable: Dict[int, VariableTracker]
|
||||
store_attr_mutations: Dict[AttributeMutation, Dict[str, VariableTracker]]
|
||||
keepalive: List[Any]
|
||||
|
||||
def __init__(self, id_to_variable=None, store_attr_mutations=None, keepalive=None):
|
||||
super(SideEffects, self).__init__()
|
||||
super().__init__()
|
||||
self.id_to_variable = id_to_variable or collections.OrderedDict()
|
||||
self.store_attr_mutations = store_attr_mutations or collections.OrderedDict()
|
||||
self.keepalive = keepalive or []
|
||||
|
Reference in New Issue
Block a user