Your TensorDataset will return the data and target batch, so you could unwrap inputs or assign the return values to separate tensors:
for inputs in loader:
    data, target = inputs
    outputs = model(data)
    loss = criterion(outputs, target)

# or
for data, target in loader:
    ...