Linear:updateGradInput avoids NaN and inf

The resize in Linear:updateGradInput can introduce NaN and inf into the
gradients. The resize itself leaves garbage in the gradInput tensor.
For normal numbers the subsequent addmm/addmv will clear the garbage.
However, if gradInput contains either nan or inf after the resize, the
multiply will result in nan instead of the desired result.
Merge pull request #117 from akfidjeland/linear_nan

Linear:updateGradInput avoids NaN and inf