I’m not sure, where you are initializing the net instance, as the code shouldn’t run in the first place.
(opt_Adam is using net.parameters() outside of train_model, which will fail, since net is initialized inside train_model)
This minimal example will run:
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")


def train_model(model, criterion, num_epochs=30):
    
    net.to(device)
    criterion = nn.MSELoss()
    optimizer = optim.Adam(net.parameters(), lr=0.1, betas=(0.9, 0.99))

    for epoch in range(num_epochs):
        running_loss = 0.0
        print("Epoch {}/{}".format(epoch, num_epochs-1))
        print("-" * 10)

        for i in range(1):
            image = torch.randn(1, 1)
            image = image.to(device)

            pressure = torch.randn(1, 1)
            pressure = pressure.to(device)

            optimizer.zero_grad()
            output = net(pressure)
            loss = criterion(output, image)
            loss.backward()
            optimizer.step()

            running_loss += loss.item()

            if (i+1) % 100 == 0:
                print("%d, %5d, loss: %.3f" % (epoch, i, running_loss/100))
                running_loss = 0.0
        



class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc1 = nn.Linear(1, 1)
        
    def forward(self, x):
        x = self.fc1(x)
        return x


net = Net()
train_model(model=net, criterion=nn.MSELoss())