thank you for that richard, however i am still having a problem so what i am trying to do is to take a gaussian distribution over the output of my network and then to take a random sample from this distribution as use that in the loss funciton, however when i try do to this i get this error
variables, grad_variables, retain_graph)
RuntimeError: element 0 of variables does not require grad and does not have a grad_fn