kornia icon indicating copy to clipboard operation
kornia copied to clipboard

how do u set kornia?

Open xalteropsx opened this issue 1 year ago • 1 comments

self.set_rng_device_and_dtype(device="cuda", dtype=torch.float64) i didnt understand this part

what is self here ? and how do u set kornia to cuda ? so whatever i run it use gpu ?

xalteropsx avatar Jun 25 '24 13:06 xalteropsx

@xalteropsx can you point to codebase / version ? or how are you attempting to use?

edgarriba avatar Jun 27 '24 07:06 edgarriba

@xalteropsx i'll give a shot in the dark here, so, an example for your side will be welcomed

I know this is a method from the augmentation container, so if you are trying to setup an augmentation or a augmentation container you can follow this:

import torch
from kornia.augmentation import RandomJPEG

device = "cuda"
jpegq = (1.0, 50.0)
aug = RandomJPEG(jpeg_quality=jpegq, p=1.0)
aug.set_rng_device_and_dtype(device=torch.device(device), dtype=torch.float32)
example_input = torch.randn((3, 224, 224)).to(device)
res = aug(example_input)

where the self, refers to the augmentation or container instantiated class

johnnv1 avatar Jul 02 '24 01:07 johnnv1