Auto-encoder for vector encodings
Here is an autoencoder I wrote to encode two vectors : 

[1,2,3] &amp; [1,2,3]

The vectors are created in : features = torch.tensor(np.array([ [1,2,3],[1,2,3] ]))

This works as per code : 

%reset -f

epochs = 1000
from pylab import plt
plt.style.use('seaborn')
import torch.utils.data as data_utils
import torch
import torchvision
import torch.nn as nn
from torch.autograd import Variable

cuda = torch.cuda.is_available()
FloatTensor = torch.cuda.FloatTensor if cuda else torch.FloatTensor
import numpy as np
import pandas as pd
import datetime as dt


features = torch.tensor(np.array([ [1,2,3],[1,2,3] ]))

print(features)

batch = 2
data_loader = torch.utils.data.DataLoader(features, batch_size=2, shuffle=True)

encoder = nn.Sequential(nn.Linear(3,batch), nn.Sigmoid())
decoder = nn.Sequential(nn.Linear(batch,3), nn.Sigmoid())
autoencoder = nn.Sequential(encoder, decoder)

optimizer = torch.optim.Adam(params=autoencoder.parameters(), lr=0.001)

encoded_images = []
for i in range(epochs):
    for j, (images, _) in enumerate(data_loader):
    #     images = images.view(images.size(0), -1) 
        images = Variable(images).type(FloatTensor)
        optimizer.zero_grad()
        reconstructions = autoencoder(images)
        loss = torch.dist(images, reconstructions)
        loss.backward()
        optimizer.step()

        encoded_images.append(encoder(images))


But when I add a new vector : 

features = torch.tensor(np.array([ [1,2,3],[1,2,3],[1,2,3] ]))


I receive error : 

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-223-3ca45519e975&gt; in &lt;module&gt;
     32 encoded_images = []
     33 for i in range(epochs):
---&gt; 34     for j, (images, _) in enumerate(data_loader):
     35     #     images = images.view(images.size(0), -1)
     36         images = Variable(images).type(FloatTensor)

ValueError: not enough values to unpack (expected 2, got 1)


Have I setup my data loader correctly ?

your Dataset (inside DataLoader) returns only image per item without label. When you iterate and expecting each item to be (image, _) you are trying to unpack a feature without a label into image and _ and this is not possible. This is why you get "not enough values to unpack" error
