File tree Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -2841,18 +2841,7 @@ def make_batch(self) -> tuple[list, dict]:
2841
2841
def fn (self ) -> Callable :
2842
2842
from thunder .tests .resnet import resnet50
2843
2843
2844
- # Thunder does not support inplace
2845
- def avoid_add_ (m ):
2846
- if isinstance (m , torch .nn .modules .batchnorm ._BatchNorm ):
2847
- m .num_batches_tracked = None
2848
-
2849
- def avoid_relu_inplace (m ):
2850
- if isinstance (m , torch .nn .modules .activation .ReLU ):
2851
- m .inplace = False
2852
-
2853
2844
model = resnet50 ()
2854
- model .apply (avoid_add_ )
2855
- model .apply (avoid_relu_inplace )
2856
2845
model = model .to (device = self .device , dtype = self .tdtype ).requires_grad_ (self .requires_grad )
2857
2846
return model
2858
2847
Original file line number Diff line number Diff line change @@ -76,9 +76,7 @@ def forward(self, x: Tensor) -> Tensor:
76
76
if self .downsample is not None :
77
77
identity = self .downsample (x )
78
78
79
- # Thunder: Inplace operators like __iadd__ are not supported
80
- # out += identity
81
- out = out + identity
79
+ out += identity
82
80
out = self .relu (out )
83
81
84
82
return out
@@ -136,9 +134,7 @@ def forward(self, x: Tensor) -> Tensor:
136
134
if self .downsample is not None :
137
135
identity = self .downsample (x )
138
136
139
- # Thunder: Inplace operators like __iadd__ are not supported
140
- # out += identity
141
- out = out + identity
137
+ out += identity
142
138
out = self .relu (out )
143
139
144
140
return out
You can’t perform that action at this time.
0 commit comments