If you pass weight as ones, you should get the same result and I couldn’t reproduce this issue:
torch.manual_seed(2809)

class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.conv1 = nn.Conv2d(3, 6 ,3, 1, 1)
        self.pool1 = nn.MaxPool2d(2)
        self.conv2 = nn.Conv2d(6, 12, 3, 1, 1)
        self.pool2 = nn.MaxPool2d(2)
        self.fc1 = nn.Linear(12*6*6, 64)
        self.fc_out = nn.Linear(64, 10)
        
    def forward(self, x):
        x = self.pool1(F.relu(self.conv1(x)))
        x = self.pool2(F.relu(self.conv2(x)))
        x = x.view(x.size(0), -1)
        x = F.relu(self.fc1(x))
        x = self.fc_out(x)
        return x


model = MyModel()
data = torch.randn(100, 3, 24, 24)
target = torch.empty(100, dtype=torch.long).random_(10)

criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=1e-3)

for epoch in range(10):
    optimizer.zero_grad()
    output = model(data)
    loss = criterion(output, target)
    loss.backward()
    optimizer.step()
    print('Epoch {}, loss {}'.format(epoch, loss.item()))
    

# Use weights
torch.manual_seed(2809)
model_weighted = MyModel()

criterion_weighted = nn.CrossEntropyLoss(weight=torch.ones(10))
optimizer_weighted = optim.Adam(model_weighted.parameters(), lr=1e-3)

for epoch in range(10):
    optimizer_weighted.zero_grad()
    output = model_weighted(data)
    loss = criterion_weighted(output, target)
    loss.backward()
    optimizer_weighted.step()
    print('Weighted: Epoch {}, loss {}'.format(epoch, loss.item()))

Both training loops yield the same results.