blocks.utils.tf

Functions

blocks.utils.tf.get_balancing_weights(masks, correction=0.001)[source]

Compute weights balancing zeros and ones in the given masks tensor.

Warning

The masks tensor must be binary - i.e., contain only ones and zeros!

Parameters
  • masks (Tensor) – zero/one masks to be balanced

  • correction (float) – correction parameter to avoid divergence of weights

Return type

Tensor

Returns

weights balancing the given mask (having the same shape)