I am migrating a legacy app from Torch which uses VGG19 pretrained model. The following code:
vgg_features = VGG19(weights='imagenet', include_top=False)
self.f1 = Sequential(*[vgg_features[x] for x in range(2)])
hits the following error:
self.f1 = Sequential(*[vgg_features[x] for x in range(2)])
~~~~~~~~~~~~^^^
TypeError: 'Functional' object is not subscriptable
The legacy PyTorch code that I am trying to migrate from is:
vgg_features = models.vgg19(pretrained=True).features
which doesn’t need to call predict() on any input data at all.