torchstain icon indicating copy to clipboard operation
torchstain copied to clipboard

No GPU acceleration in torch backend

Open CielAl opened this issue 11 months ago • 0 comments

Describe the bug A clear and concise description of what the bug is. It seems like all parameters of the torch-based normalizers are hard coded as tensors on CPUs and therefore there are no GPU acceleration at all unless one explicitly move the target, input, and all stain vectors to GPU devices. Might be an easier way to fix this by making your torch normalizer also extend from torch.nn.Modules like all torchvision's transformation API does, and use register_buffer to store parameters and the whole normalizer object can be moved to specified device as whole.

To Reproduce Steps to reproduce the behavior. Ideally a gist but a simple code example is also fine.

Expected behavior A clear and concise description of what you expected to happen.

Logs If applicable, add sufficient logs to assist in debugging the problem.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu, Windows, macOS]
  • Version [e.g. 20.04, 10, Catalina]

CielAl avatar Jul 20 '23 08:07 CielAl