Skip to content

Commit

Permalink
error with filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Line290 authored May 10, 2018
1 parent 702ae35 commit 4eed286
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def _construct_diff_model(self, base_model, keep_rgb=False):
# Torch models are usually defined in a hierarchical way.
# nn.modules.children() return all sub modules in a DFS manner
modules = list(self.base_model.modules())
first_conv_idx = filter(lambda x: isinstance(modules[x], nn.Conv2d), list(range(len(modules))))[0]
first_conv_idx = list(filter(lambda x: isinstance(modules[x], nn.Conv2d), list(range(len(modules)))))[0]
conv_layer = modules[first_conv_idx]
container = modules[first_conv_idx - 1]

Expand Down Expand Up @@ -301,4 +301,4 @@ def get_augmentation(self):
GroupRandomHorizontalFlip(is_flow=True)])
elif self.modality == 'RGBDiff':
return torchvision.transforms.Compose([GroupMultiScaleCrop(self.input_size, [1, .875, .75]),
GroupRandomHorizontalFlip(is_flow=False)])
GroupRandomHorizontalFlip(is_flow=False)])

0 comments on commit 4eed286

Please sign in to comment.