I tried but it throws error as
# criterion_xent = nn.CrossEntropyLoss()
criterion_cent = center_loss()
# optimizer_model = torch.optim.Adam(cnn.parameters(), lr=0.001)
optimizer_centloss = torch.optim.Adam(criterion_cent, lr=0.01)


**---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
 in ()
2 criterion_cent = center_loss()
3 # optimizer_model = torch.optim.Adam(cnn.parameters(), lr=0.001)
----> 4 optimizer_centloss = torch.optim.Adam(criterion_cent, lr=0.01)
~/anaconda3/envs/torch/lib/python3.6/site-packages/torch/optim/adam.py in init(self, params, lr, betas, eps, weight_decay, amsgrad)
39         defaults = dict(lr=lr, betas=betas, eps=eps,
40                         weight_decay=weight_decay, amsgrad=amsgrad)
—> 41         super(Adam, self).init(params, defaults)
42
43     def setstate(self, state):
~/anaconda3/envs/torch/lib/python3.6/site-packages/torch/optim/optimizer.py in init(self, params, defaults)
34         self.param_groups = []
35
—> 36         param_groups = list(params)
37         if len(param_groups) == 0:
38             raise ValueError(“optimizer got an empty parameter list”)
TypeError: ‘center_loss’ object is not iterable
**