INNER CODE UNIT · Python
img_x
GaParmar/clean-fid · cleanfid/clip_features.py:27
img_x = img_t/255.0
T_norm = transforms.Normalize((0.48145466, 0.4578275, 0.40821073), (0.26862954, 0.26130258, 0.27577711))
img_x = T_norm(img_x)
assert torch.is_tensor(img_x)
if len(img_x.shape)==3:
img_x = img_x.unsqueeze(0)
B,C,H,W = img_x.shape
with torch.no_grad():
z = self.model.encode_image(img_x)
return z