Right now, the shape of “images” is [171,11]. I changed images = images.reshape(-1, input_size).to(device) to images = images.view(images.size(0), -1).to(device) in both of my loops. Now I am getting the error:
Traceback (most recent call last):
  File "D:\Users\Google Drive\PycharmProjects\\My_FFNN_Ex.py", line 184, in <module>
    outputs = model(images)
  File "F:\ProgramData\Anaconda3\envs\placeholder\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "D:\Users\Google Drive\PycharmProjects\My_FFNN_Ex.py", line 160, in forward
    out = self.l1(x)
  File "F:\ProgramData\Anaconda3\envs\placeholder\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "F:\ProgramData\Anaconda3\envs\placeholder\lib\site-packages\torch\nn\modules\linear.py", line 96, in forward
    return F.linear(input, self.weight, self.bias)
  File "F:\ProgramData\Anaconda3\envs\placeholder\lib\site-packages\torch\nn\functional.py", line 1847, in linear
    return torch._C._nn.linear(input, weight, bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (171x11 and 1881x9)


This is what my code looks like right now:
import matplotlib.pyplot as plt
import pandas as pd

import torch
import torch.nn as nn
from torch.utils.data import Dataset
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler

df_ip = pd.read_csv('./data_lstm.csv')
df_timestamp = df_ip['bucket']


class FeatureDatasetTrain(Dataset):
    def __init__(self, file_name):
        df_input = pd.read_csv('./data_lstm.csv')

        # 2/3 of thge data for training
        x = df_input.values[0:round(df_input.shape[0]/3*2), :]
        # generate labels
        for j in range(df_input.shape[0]):
            tmp_float = df_input.iloc[j]['my_col']

            if tmp_float < 500.0:
                df_input.at[j, 'label'] = 1
            elif tmp_float >= 500.0 and tmp_float < 600.0:
                df_input.at[j, 'label'] = 2
            else:
                df_input.at[j, 'label'] = 3


        # Label for first 2/3 as y
        y = df_input.iloc[0:round((df_input.shape[0]/3*2)), -1].values


        sc = StandardScaler()
        print(x.shape)
        print(x)
        x_train = sc.fit_transform(x)
        print(x_train.shape)
        print(x_train)
        y_train = y

        # 256*11
        self.X_train = torch.tensor(x_train, dtype=torch.float32)
        self.y_train = torch.tensor(y_train)
        print(self.y_train.shape)



    def __len__(self):
        return len(self.y_train)

    def __getitem__(self, idx):
        return self.X_train[idx], self.y_train[idx]


class FeatureDatasetTest(Dataset):
    def __init__(self, file_name):
        df_input = pd.read_csv('./data_lstm.csv')

        # 1/3 of thge data for training
        x = df_input.values[(round(df_input.shape[0] / 3 * 2)+1):, :]
        # generate label
        for j in range(df_input.shape[0]):
            tmp_float = df_input.iloc[j]['my_col']

            if tmp_float < 500.0:
                df_input.at[j, 'label'] = 1
            elif tmp_float >= 500.0 and tmp_float < 600.0:
                df_input.at[j, 'label'] = 2
            else:
                df_input.at[j, 'label'] = 3


        # Last 1/3 as y
        y = df_input.iloc[(round(df_input.shape[0] / 3 * 2))+1:, -1].values

        sc = StandardScaler()
        x_test = sc.fit_transform(x)
        y_test = y

        self.X_test = torch.tensor(x_test, dtype=torch.float32)
        self.y_test = torch.tensor(y_test)

    def __len__(self):
        return len(self.y_test)

    def __getitem__(self, idx):
        return self.X_test[idx], self.y_test[idx]

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')


# Hyper-Parameter
input_size = 171*11
hidden_size = 9
num_classes = 3 # number of labels
num_epochs = 10
#batch_size_full = 256    #round((df_ip.shape[0]/2*3))
batch_size_train = round((df_ip.shape[0]/3*2)) # = 171
batch_size_test = round(df_ip.shape[0] - round(df_ip.shape[0]/3*2)) # = 85
learning_rate = 0.001


train_dataset = FeatureDatasetTrain('./data_lstm.csv')
test_dataset = FeatureDatasetTest('./data_lstm.csv')


train_loader = torch.utils.data.DataLoader(dataset=train_dataset, batch_size=batch_size_train, shuffle= True)
test_loader = torch.utils.data.DataLoader(dataset=test_dataset, batch_size=batch_size_test, shuffle= False)


examples = iter(train_loader)
samples, labels = examples.next()


class NeuralNet(nn.Module):
    def __init__(self, input_size, hidden_size, num_classes):
        super(NeuralNet, self).__init__()
        self.input_size = input_size
        self.l1 = nn.Linear(input_size, hidden_size)
        self.relu = nn.ReLU()
        self.l2 = nn.Linear(hidden_size, num_classes)

    def forward(self, x):
        out = self.l1(x)
        out = self.relu(out)
        out = self.l2(out)

        return out

model = NeuralNet(input_size, hidden_size, num_classes).to(device)

criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)

n_total_steps = len(train_loader)

for epoch in range(num_epochs):
    for i, (images, labels) in enumerate(train_loader):
        images = images.view(images.size(0), -1).to(device)
        print('->')
        print(images.size())
        print('<-')
        labels = labels.to(device)

        # forward
        outputs = model(images)
        loss = nn.NLLLoss()

        # backward
        optimizer.zero_grad()
        optimizer.step()

        if (i+1) % 100 == 0:
            print (f'Epoch [{epoch+1}/{num_epochs}], Step [{i+1}/{n_total_steps}], Loss: {loss.item():.4f}')

# test

with torch.no_grad():
    n_correct = 0
    n_samples = 0
    for images, labels in test_loader:
        images = images.view(images.size(0), -1).to(device)
        labels = labels.to(device)
        outputs = model(images)

        _, predicted = torch.max(outputs.data, 1)
        n_samples += labels.size(0)
        n_correct += (predicted == labels).sum().item()

    print(n_samples)
    print(n_correct)
    acc = 100.0 * n_correct / n_samples
    print(f'Accuracy of the network on the 10000 test images: {acc} %')