Hmm, Variable does not support fill_() or zero_() methods… I need a mask, which I don’t really want… but which performs the two steps my hack involve.
So, is there now a workout about this selective zeroing?
OK, making progress:
In [22]: c
Out[22]: 
Variable containing:
 0.8491
 0.1877
 0.1560
 0.5188
 0.7464
[torch.FloatTensor of size 5]

In [23]: set(dir(c)) - set(dir(c.data))
Out[23]: 
{'__getattr__',
 '__rpow__',
 '__setstate__',
 '_add',
 '_addcop',
 '_backward_hooks',
 '_blas',
 '_creator',
 '_do_backward',
 '_execution_engine',
 '_fallthrough_methods',
 '_get_type',
 '_grad',
 '_static_blas',
 '_sub',
 '_version',
 'backward',
 'creator',
 'data',
 'detach',
 'detach_',
 'grad',
 'index_add',
 'index_copy',
 'index_fill',
 'masked_copy',
 'masked_fill',
 'output_nr',
 'register_hook',
 'reinforce',
 'requires_grad',
 'resize',
 'resize_as',
 'scatter',
 'volatile'}