Thanks for your reply.

Here top_class is a 2D tensor with shape (64, 1) while labels is 1D with shape (64) .

We need to have top_class with shape of (64, 1) and ‘labels’ (1,64) in order for it to invoke broadcasting. With this top_class’s shape would be (64, 64) . The 64 refers to the batch size in this scenaraio.
Thanks.