def clip_loss(x, timesteps, y):
    image_features = self.image_encoder(x, timesteps)
    text_features = self.text_encoder(y)
    logit_scale = self.logit_scale(image_features.dtype)
    return clip_loss(image_features, text_features, logit_scale)
def clip_loss(x, timesteps, y):
    image_features = self.image_encoder(x, timesteps)
    text_features = self.text_encoder(y)
    logit_scale = self.logit_scale(image_features.dtype)
    return clip_loss(image_features, text_features, logit_scale)