I have a list of tensors from which I am sampling using the `torch.multinomial`

function. I should mention that the list is formed from the last layer of a convnet. I am sampling from this list and forwarding the sampled feature cube through an lstm. The LSTM solves a regression problem by fitting the sampled feature cube to some labeled data set which I provide.

When I call `backward()`

on my loss however, I get

```
13 def _do_backward(self, grad_output, retain_variables):
14 if self.reward is _NOT_PROVIDED:
---> 15 raise RuntimeError("differentiating stochastic functions requires "
global RuntimeError = undefined
16 "providing a reward")
17 result = super(StochasticFunction, self)._do_backward((self.reward,), retain_variables)
RuntimeError: differentiating stochastic functions requires providing a reward
> /home/lex/anaconda2/envs/py27/lib/python2.7/site-packages/torch/autograd/stochastic_function.py(15)_do_backward()
13 def _do_backward(self, grad_output, retain_variables):
14 if self.reward is _NOT_PROVIDED:
---> 15 raise RuntimeError("differentiating stochastic functions requires "
16 "providing a reward")
17 result = super(StochasticFunction, self)._do_backward((self.reward,), retain_variables)
```

What does it expect as reward?

FWIW, I am training like so:

```
clsfx_crit = nn.CrossEntropyLoss()
regress_crit = nn.MSELoss()
clsfx_optimizer = torch.optim.Adam(resnet.parameters(), clr)
rnn_optimizer = optim.SGD(regressor.parameters(), rlr)
# Train classifier
for epoch in range(maxIter): #run through the images maxIter times
for i, (train_X, train_Y) in enumerate(train_loader):
images = Variable(train_X)
labels = Variable(train_Y)
#rnn input
rtargets = targ_X[:,i:i+regressLength,:]
#reshape targets for inputs
rtargets = Variable(rtargets.view(regressLength, -1))
# Forward + Backward + Optimize
clsfx_optimizer.zero_grad()
rnn_optimizer.zero_grad()
#predict classifier outs and regressor outputs
outputs = resnet(images)
routputs = regressor(rtrain_X)
#compute loss
loss = clsfx_crit(outputs, labels)
rloss = regress_crit(routputs, rtargets)
#backward pass
loss.backward()
rloss.backward()
# step optimizer
clsfx_optimizer.step()
rnn_optimizer.step()
```