def forward(self, x, timesteps, y=None):
    '\n        Apply the model to an input batch.\n\n        :param x: an [N x C x ...] Tensor of inputs.\n        :param timesteps: a 1-D batch of timesteps.\n        :param y: an [N, L] Tensor of texts, if conditional.\n        :return: an [N x C x ...] Tensor of outputs.\n        '
    hs = []
    emb = self.time_embed(timestep_embedding(timesteps, self.model_channels))
    if hasattr(self, 'text_encoder'):
        y = self.text_encoder(y)
    else:
        y = None
    h = x.type(self.dtype)
    for module in self.input_blocks:
        h = module(h, emb, y=y)
        hs.append(h)
    h = self.middle_block(h, emb, y=y)
    for module in self.output_blocks:
        h = th.cat([h, hs.pop()], dim=1)
        h = module(h, emb, y=y)
    h = h.type(x.dtype)
    return self.out(h)
Apply the model to an input batch.

:param x: an [N x C x ...] Tensor of inputs.
:param timesteps: a 1-D batch of timesteps.
:param y: an [N, L] Tensor of texts, if conditional.
:return: an [N x C x ...] Tensor of outputs.
def forward(self, x, timesteps, y=None):
    '\n        Apply the model to an input batch.\n\n        :param x: an [N x C x ...] Tensor of inputs.\n        :param timesteps: a 1-D batch of timesteps.\n        :param y: an [N, L] Tensor of texts, if conditional.\n        :return: an [N x C x ...] Tensor of outputs.\n        '
    hs = []
    emb = self.time_embed(timestep_embedding(timesteps, self.model_channels))
    if hasattr(self, 'text_encoder'):
        y = self.text_encoder(y)
    else:
        y = None
    h = x.type(self.dtype)
    for module in self.input_blocks:
        h = module(h, emb, y=y)
        hs.append(h)
    h = self.middle_block(h, emb, y=y)
    for module in self.output_blocks:
        h = th.cat([h, hs.pop()], dim=1)
        h = module(h, emb, y=y)
    h = h.type(x.dtype)
    return self.out(h)