Thanks for the reply!
I tried your approach like so
# setup
train_dataA = torch.utils.data.TensorDataset(torch.randn(10, 1), torch.randn(10, 1))
train_dataB = torch.utils.data.TensorDataset(torch.randn(10, 1), torch.randn(10, 1))

# access internal attribute
train_dataA.tensors[0].shape

# concat
train_data = torch.utils.data.ConcatDataset((train_dataA, train_dataB))

# access attribute through the internal datasets
train_data.datasets[0].tensors[0].shape

But it seems to be having issues in the defined function here
def make_weights_for_balanced_classes(images, nclasses):                        
    count = [0] * nclasses                                                      
    for item in images:                                                         
        count[item[1]] += 1                                                     
    weight_per_class = [0.] * nclasses                                      
    N = float(np.max(count))                                                   
    for i in range(nclasses):                                                   
        weight_per_class[i] = N/float(count[i])                                 
#     weight = [0] * len(images)                                              
#     for idx, val in enumerate(images):                                          
#         weight[idx] = weight_per_class[val[1]]                                  
    return weight_per_class

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-49-93f1a7a4ed45> in <module>()
----> 1 weights = make_weights_for_balanced_classes(train_data.datasets[0].tensors[0].shape, carClasses) #len(train_data.classes)
      2 weights[1] /= 2
      3 weights = torch.FloatTensor(weights)
      4 print(weights)

<ipython-input-42-7fa267b3c6b9> in make_weights_for_balanced_classes(images, nclasses)
      2     count = [0] * nclasses
      3     for item in images:
----> 4         count[item[1]] += 1
      5     weight_per_class = [0.] * nclasses
      6     N = float(np.max(count))

TypeError: 'int' object is not subscriptable

Sorry if I misinterpreted your code, was there something that I missed?
I’m still quite new to PyTorch, I need to get familiar with all the library functions.