I am trying to use Binary Cross Entropy Loss (BCE loss) for Simese network.
I have two inputs for BCE loss function:
(input_dy)→ tensor of size  , output of neural network
(y_true)→ tensor of size , target (true value)
For BCE loss, the input parameters must be of the dimension:
(input_dy)→ [Batch_size, no. of classes]
The following diagram explains the query:
I need a function in python using pytorch to convert the
dy matrix to a 2D matrix with the output probabilities that sum to 1. [To note:
dy should be iterated through length of it, as it is the output of the network for every input ]
Further a 2D array must be represented into one hot encoding, which will be true_labels (that will represent Binary classes with 0 & 1)
I need both output matrix and true_labels matrix for BCE Loss with following dimensions:
- output dimension → [4, 2]
- true_labels → 
Any help is most appreciated!
Thank you in advance. @ptrblck