Hello,
I am using pre-trained models on imagenet to build custom video classification models.
In the first phase, we compute the forward on every frame:
outputs = []
for i in range(n_frames):
     outputs.append(pretrained_model(video[i])

Given that “outputs” is updated at each iteration, this loop results in a nested computational graph because the graphs are retained at every iteration.
This causes a cuda out of memory for big models.
Is there a way to do this better ?
Thanks