pytorch lightning init not on cuda

Solutions on MaxInterview for pytorch lightning init not on cuda by the best coders in the world

showing results for - "pytorch lightning init not on cuda"
Clifton
10 Jan 2020
1# tensor created in __init__ wont be added to cuda
2# use self.register_buffer to register variables 
3
4class LitModel(LightningModule):
5
6    def __init__(self):
7        ...
8        self.register_buffer("sigma", torch.eye(3))
9        # you can now access self.sigma anywhere in your module