I am quite new to pytorch, can you give me an example to add layer to model, train it.
During test strip it and get features from last but layer.
model= models.resnet34(pretrained=True)
# add some layer to model -- some example here

# train phase
x = torch.randn(1, 3, 224, 224)
out = model(x)
# test phase
feature_extractor = torch.nn.Sequential(*list(model_ft.children())[:-1])
y = torch.randn(1, 3, 224, 224)
out = feature_extractor(y) # in this example need 1000 features