Thank you for reply.
The more code lines are like below
features = []
with torch.no_grad():
    for batch_idx, (inputs, targets) in enumerate(train_loader):
         outputs = model.extract_features(inputs) # <- It causes memory leakage
         features.append(outputs)
    # Concat all features
    npy_data = torch.cat((features[:]))
    npy_data = np.array(npy_data.cpu())
    np.save('data_npy/data.npy', npy_data)

When i extract last convolution layer’s features, GPU memory is not raising
I think, The first convolution layer’s dimension is [-1, 64, 32, 32], last convolution layer’s dimension is [-1, 512, 4, 4].
[-1, 64, 32, 32] is more bigger than [-1, 512, 4, 4]. So I think it is the reason that the problem to occur