The weights should correspond to each sample in the train set. If their are 10,000 samples in the train set, the weights should correspond to each of the 10,000 samples. You would want to do something like this:
inputs,targets = train_ds ##Modify this to get all targets 
weight = 1. / class_sample_count
samples_weight = weight [ targets ]  ### You should get the labels in