if weight_map is not None:
weight_b = tf.reshape(weight_map[b_ind], ref_shape)
if weight_b.get_shape().as_list()[-1] == 1:
weight_b = tf.squeeze(weight_b, axis=-1)
else:
weight_b = None
// preparing loss function parameters
After Change
pred_b = tf.reshape(pred_b, [-1, self._num_classes])
if self._softmax:
pred_b = tf.nn.softmax(
tf.cast(pred_b, dtype=tf.float32))
ground_truth_b = ground_truth[b_ind]
weight_b = None if weight_map is None else weight_map[b_ind]
loss_params = {