This PR solve #33 by removing device from the argument list, which will require the user to manually put input tensors to device as done in the example code in README.
The property solution mentioned in #33 is not adopted as it does work with nn.DataParallel.
When the devices of input tensor and module parameters match, the following to device on the input tensor is not required, which are removed in this PR:
Besides, as positional encoding is created from a buffer whose device is changed with the module, we don't have to call to device here, which is also removed in this PR.
This PR solve #33 by removing device from the argument list, which will require the user to manually put input tensors to device as done in the example code in README.
The
property
solution mentioned in #33 is not adopted as it does work withnn.DataParallel
.When the devices of input tensor and module parameters match, the following to device on the input tensor is not required, which are removed in this PR:
https://github.com/sooftware/conformer/blob/348e8af6c156dae19e311697cbb22b9581880a12/conformer/encoder.py#L117
Besides, as positional encoding is created from a buffer whose device is changed with the module, we don't have to call to device here, which is also removed in this PR.
https://github.com/sooftware/conformer/blob/610a77667aafe533a85001298c522e7079503da4/conformer/attention.py#L147