function customLossFunction(yTrue, yPred) {
  return tf.tidy(() => {
    // Scale the the first column (0-1 shape indicator) of `yTrue` in order
    // to ensure balanced contributions to the final loss value
    // from shape and bounding-box predictions.
    return tf.metrics.meanSquaredError(yTrue.mul(LABEL_MULTIPLIER), yPred);
  });
}
Custom loss function for object detection.

The loss function is a sum of two losses
- shape-class loss, computed as binaryCrossentropy and scaled by
  `classLossMultiplier` to match the scale of the bounding-box loss
  approximatey.
- bounding-box loss, computed as the meanSquaredError between the
  true and predicted bounding boxes.
@param {tf.Tensor} yTrue True labels. Shape: [batchSize, 5].
  The first column is a 0-1 indicator for whether the shape is a triangle
  (0) or a rectangle (1). The remaining for columns are the bounding boxes
  for the target shape: [left, right, top, bottom], in unit of pixels.
  The bounding box values are in the range [0, CANVAS_SIZE).
@param {tf.Tensor} yPred Predicted labels. Shape: the same as `yTrue`.
@return {tf.Tensor} Loss scalar.