Optimizer params argument is not an iterable of Tensors

Hello,

I am quite new to PyTorch and deep learning in general. I am trying to identify a simple problem. I have written a basic image classifier running on the MNIST dataset. Everything works fine up to this point. However, I am trying to use a modified parameter set for the optimizer. It should be a totally custom parameter space and the optimizer should take steps in that parameter space. I am not able to perform this operation since I am only providing the optimizer with a Tensor but not an iterable. My question is that how can I convert a torch.Tensor into an iterable of torch.Tensor.

Thanks!

A list is an iterable. try to pass [tensor]

4 Likes

Thank you very much this worked :slight_smile: