ATen
ATen copied to clipboard
Consider removing _forward ATen methods when there are no buffers
I spent some time scratching my head on why there was both prelu
and prelu_forward
when they looked exactly identical. The answer is, based on reading nn_parse.py, that prelu doesn't have any buffers, so the "base" signature (which has no buffers) ends up being the same as the raw forward signature.
Let us consider adding a little bit of logic to delete the _forward
declaration when it is the same as the base, so there aren't two ways to spell the same thing. The only thing I am not sure about is if there is any code that is taking advantage of this uniformity, in which case it might be better to have both? Not sure.
Well, gen_variable_type.py
does seem to rely on forward
existing:
for declaration in declarations:
name = declaration['name']
if name == 'batch_norm' or 'conv' in name:
continue
fwd_name = name + '_forward'
if fwd_name not in declarations_by_name:
continue
declaration['base_name'] = fwd_name