Skip to content

Commit 09869b0

Browse files
authored
Make BGR transform & check use only one line
1 parent 36de312 commit 09869b0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

captum/optim/_models/inception_v1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ def _transform_input(self, x: torch.Tensor) -> torch.Tensor:
134134
assert x.min() >= 0.0 and x.max() <= 1.0
135135
x = x.unsqueeze(0) if x.dim() == 3 else x
136136
x = x * 255 - 117
137-
if self.bgr_transform:
138-
x = x.clone()[:, [2, 1, 0]] # RGB to BGR
137+
x = x[:, [2, 1, 0]] if self.bgr_transform else x
139138
return x
140139

141140
def forward(

0 commit comments

Comments
 (0)