Extracting hidden representations from an autoencoder using Pytorch
After having trained an AutoEncoder with PyTorch, how can I extract the low-dimensional embeddings of input features at some hidden-level?

You can just define your model such that it optionally returns the intermediate pytorch variable calculated during the forward pass. Simple example:
class Autoencoder(nn.Module):
    def __init__(self, input_size, hidden_size):
    super().__init__()
    self.encoder = nn.Sequential(
    nn.Linear(input_size, hidden_size),
    nn.ReLU(),
    nn.Linear(hidden_size, 3)) #reduce the size

    self.decoder = nn.Sequential(
    nn.Linear(3, hidden_size),
    nn.ReLU(),
    nn.Linear(hidden_size, input_size),
    nn.ReLU()) #reduce the size

def forward(self, x, return_encoding = False):
    encoded = self.encoder(x)
    decoded = self.decoder(encoded)

    if return_encoding:
        return decoded,encoded
    return decoded

