The output shown above is from when a WeightedRandomSampler is used. The use of the sampler did not seem to solve the problem so I commented it out.
Here is my code in the current state:
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import torch
from torch import nn
from torch.nn import functional as f
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import io


def convertStarToInt(arr):
    output = []
    for item in arr:
        if ("Iab" in item[2]):
            output.append([item[0], item[1], 1])
        elif ("D" in item[2]):
            output.append([item[0], item[1], 8])
        elif ("Ia" in item[2]):
            output.append([item[0], item[1], 0])
        elif ("Ib" in item[2]):
            output.append([item[0], item[1], 2])
        elif ("III" in item[2]):
            output.append([item[0], item[1], 4])
        elif ("IV" in item[2]):
            output.append([item[0], item[1], 5])
        elif ("VII" in item[2]):
            output.append([item[0], item[1], 8])
        elif ("VI" in item[2]):
            output.append([item[0], item[1], 7])
        elif ("sd" in item[2]):
            output.append([item[0], item[1], 7])
        elif ("V" in item[2]):
            output.append([item[0], item[1], 6])
        elif ("II" in item[2]):
            output.append([item[0], item[1], 3])
    return output

def countStars(arr):
    a = 0
    ab = 0
    b = 0
    ii = 0
    wd = 0
    iii = 0
    iv = 0
    v = 0
    vi = 0
    for item in arr:
        if (item == 1):
            ab += 1
        elif (item == 8):
            wd += 1
        elif (item == 0):
            a += 1
        elif (item == 2):
            b += 1
        elif (item == 4):
            iii += 1
        elif (item == 5):
            iv += 1
        elif (item == 7):
            vi += 1
        elif (item == 6):
            v += 1
        elif (item == 3):
            ii += 1
    output = [a, ab, b, ii, iii, iv, v, vi, wd]
    return output




def starToInt(arr, dictionary):
    output = []
    for item in arr:
        output.append(dictionary.index(item))
    return output


TrainingTestData = (pd.read_csv(io.BytesIO(uploaded['TrainingTestData.csv']))).values.tolist()

del TrainingTestData[0]
Data = convertStarToInt(TrainingTestData)
StarTypes = []
StarProperties = []
for row in Data:
    StarTypes.append(row[2])
    StarProperties.append([row[0], row[1]])

TrainData, TestData, TrainOutput, TestOutput = train_test_split(
    StarProperties, StarTypes, test_size=0.4, random_state=372)

StarCount = countStars(TrainOutput)
weights = []
for starType in StarCount:
  weights.append(1.0/starType)

TrainData = torch.from_numpy(np.array(TrainData).astype(dtype = "float32"))
TestData = torch.from_numpy(np.array(TestData).astype(dtype = "float32"))
TrainOutput = torch.from_numpy(np.array(TrainOutput).astype(dtype = "int64"))
TestOutput = torch.from_numpy(np.array(TestOutput).astype(dtype = "int64"))


class Data(Dataset):
    def __init__(self):
        self.x = (TrainData)
        self.y = (TrainOutput)
        self.len = self.x.shape[0]

    def __getitem__(self, index):
        return self.x[index], self.y[index]

    def __len__(self):
        return self.len

"""samples_weight=torch.from_numpy(np.array([weights[t] for t in TrainOutput]))"""

"""samples_weight = weights"""
"""sampler = WeightedRandomSampler(samples_weight, len(samples_weight), replacement = True)

print(samples_weight.tolist())"""

class Net(nn.Module):
    def __init__(self, D_in, H1, H2, H3, D_out):
        super(Net, self).__init__()
        self.linear1 = nn.Linear(D_in, H1)
        self.linear2 = nn.Linear(H1, H2)
        self.linear3 = nn.Linear(H2, H3)
        self.linear4 = nn.Linear(H3, D_out)

    def forward(self, x):
        x = torch.sigmoid(self.linear1(x))
        x = torch.sigmoid(self.linear2(x))
        x = torch.sigmoid(self.linear3(x))
        x = torch.sigmoid(self.linear4(x))
        return x


input_dim = 2
hidden_layer1 = 4
hidden_layer2 = 8
hidden_layer3 = 10
output_classes = 9

model = Net(input_dim, hidden_layer1, hidden_layer2, hidden_layer3, output_classes)
z = model(TestData)
print(z)
trainloader = DataLoader(dataset = Data(), batch_size = 500)



Loss = nn.CrossEntropyLoss()

learning_rate = 0.1
optimizer = torch.optim.SGD(model.parameters(), lr = learning_rate, momentum = 0.9)

n_epochs = 3
loss_list = []

for epoch in range(n_epochs):
    for x, y in trainloader:
        optimizer.zero_grad()
        z = model(x)
        loss = Loss(z, y)
        loss.backward()
        optimizer.step()
        loss_list.append(loss.data)
    
    print("Epoch is", epoch)


z = model(TestData)
print(z)
maximum, prediction = (torch.max(z.data,1))

prediction = prediction.tolist()


a = 0
b = 0.0

for index, item in enumerate(prediction):
    if item == TestOutput[index]:
        a += 1
    b += 1

print("Accuracy is", (100 * a / b),"%.")

and this is the output:
tensor([[0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975],
        [0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975],
        [0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975],
        ...,
        [0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975],
        [0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975],
        [0.4654, 0.5800, 0.6331,  ..., 0.4935, 0.4560, 0.3975]],
       grad_fn=<SigmoidBackward0>)
Epoch is 0
Epoch is 1
Epoch is 2
tensor([[0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130],
        [0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130],
        [0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130],
        ...,
        [0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130],
        [0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130],
        [0.0085, 0.0085, 0.0094,  ..., 0.9987, 0.0078, 0.0130]],
       grad_fn=<SigmoidBackward0>)
Accuracy is 48.01211098426565 %.

Is there a known case or error that would result in all of the outputs being the same. Also, how many layers and activation functions would you recommend I use?
Thanks,
Rishav