target could be a scalar, as you are calling self.final_targets with a single index.
Also data should be a single sample and I’m not sure what the [:3] indexing is doing.
Could you explain your use case a bit and what you are trying to achieve?