I tried running your model on Colab and it appears to be training OK for me. I made a few simplifications:
import torch
import random
import torch.nn as nn
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split

data = load_iris()
X = data['data']
y = data['target']

X = torch.tensor(X, dtype=torch.float32)
y = torch.tensor(y, dtype=torch.long)

out1 = nn.Linear(4,64)
relu1 = nn.ReLU()
out2 = nn.Linear(64,32)
relu2 = nn.ReLU()
out3 = nn.Linear(32,3)
model = torch.nn.Sequential(out1,relu1,out2,relu2,out3)
loss_fn = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)

sum_loss = 0
for i in range(3000):
    j = random.randint(0, X.shape[0]-1)
    pred = model.forward(X[j])
    loss = loss_fn(pred.expand(1, 3), y[j].expand(1))
    optimizer.zero_grad()
    loss.backward()
    sum_loss += loss.item()
    optimizer.step()
    if (i % 1000 == 999):
      print(sum_loss/1000)
      sum_loss = 0

Does this work for you?
Welcome to PyTorch, by the way! You might want to check out some of the tutorials here: https://pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html 4. I think they’re really helpful.