@ptrblck, I did try that. Got the following error:
TypeError: cross_entropy_loss(): argument 'target' (position 2) must be Tensor, not dict

According to it, we have to convert the target (dtype dict) to type Tensor.  But the question is, how to convert the dict obj to Tensor type?
Another interesting thing I noticed. I got the output tensor value as:
([[ 0.3085, -0.0681,  0.1395, -0.2118, -0.2023, -0.1892, -0.0647, -0.0718,
         -0.1249, -0.0592,  0.0486,  0.0403,  0.0439, -0.0640, -0.0333, -0.1105,
          0.0386, -0.2595, -0.1005, -0.0038]], grad_fn=<AddmmBackward0>)

And the target value is:
{'annotation': {'folder': 'VOC2012', 'filename': '2008_000008.jpg', 'source': {'database': 'The VOC2008 Database', 'annotation': 'PASCAL VOC2008', 'image': 'flickr'}, 'size': {'width': '500', 'height': '442', 'depth': '3'}, 'segmented': '0', 'object': [{'name': 'horse', 'pose': 'Left', 'truncated': '0', 'occluded': '1', 'bndbox': {'xmin': '53', 'ymin': '87', 'xmax': '471', 'ymax': '420'}, 'difficult': '0'}, {'name': 'person', 'pose': 'Unspecified', 'truncated': '1', 'occluded': '0', 'bndbox': {'xmin': '158', 'ymin': '44', 'xmax': '289', 'ymax': '167'}, 'difficult': '0'}]}}

How shall I compute the loss function?