ptrblck:

Do you mean each batch has a different size or what exactly are your samples?
Could you post a random tensor showing one sample batch?


Wow, thank you. The code helps me understand better what you were saying about how to actually implement the operation at the end.
Let’s see… I’m trying to think ahead to the final model, so bear with me. Also, I shouldn’t have used the word sample the way I did. Hopefully I explain it better below.
For each of the N samples (each individual recording), there are D divisions (the number of chunks that the recording is divided into (given that each recording is a different length, this number will vary), and four 1D features (each feature is a different length, and enter the graph at a different location - at least, that’s the plan). So, I see that as 4 input tensors for each sample/recording: (D,w), (D,x), (D,y), (D,z).
For each sample/recording, the output would be a 2D tensor after the softmax of (D, C).
Then, I would have a 1D class-weight tensor of 1xC classes, and for each sample, a 1D division(sample)-weight tensor of 1xD divisions.