You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The torchvision Gaussian function runs on the CPU even if your tensor is on the GPU. Here's a blur function that guarantees the blur will run very quickly on the GPU. Some adaptation for the tensor shape may need to be made; this one works for the latent tensor format:
`def gaussian_blur(tensor, kernel_size=5, sigma=1.0):
if len(tensor.shape) == 4: # Batch of images
batch_size, channels, height, width = tensor.shape
else:
raise ValueError("Expected a 4D tensor [B, C, H, W]")
The torchvision Gaussian function runs on the CPU even if your tensor is on the GPU. Here's a blur function that guarantees the blur will run very quickly on the GPU. Some adaptation for the tensor shape may need to be made; this one works for the latent tensor format:
`def gaussian_blur(tensor, kernel_size=5, sigma=1.0):
if len(tensor.shape) == 4: # Batch of images
batch_size, channels, height, width = tensor.shape
else:
raise ValueError("Expected a 4D tensor [B, C, H, W]")
The text was updated successfully, but these errors were encountered: