def METHOD_NAME(self, xs, masks, cache=None):
    """Encode input frame.
    :param torch.Tensor xs: input tensor
    :param torch.Tensor masks: input mask
    :param List[torch.Tensor] cache: cache tensors
    :return: position embedded tensor, mask and new cache
    :rtype Tuple[torch.Tensor, torch.Tensor, List[torch.Tensor]]:
    """
    if isinstance(self.embed, Conv2dSubsampling):
        xs, masks = self.embed(xs, masks)
    else:
        xs = self.embed(xs)
    new_cache_sd = []
    for ns in range(self.num_spkrs):
        if cache is None:
            cache = [
                None for _ in range(len(self.encoders_sd) + len(self.encoders_rec))
            ]
        new_cache = []
        for c, e in zip(cache[: len(self.encoders_sd)], self.encoders_sd[ns]):
            xs, masks = e(xs, masks, cache=c)
            new_cache.append(xs)
        for c, e in zip(cache[: len(self.encoders_sd) :], self.encoders_rec):
            xs, masks = e(xs, masks, cache=c)
            new_cache.append(xs)
        new_cache_sd.append(new_cache)
        if self.normalize_before:
            xs = self.after_norm(xs)
    return xs, masks, new_cache_sd