code: def minmax_statistics(x, mask, eps=1e-6, dim=-1):
      """MinMax Scaler
  
      Standardizes temporal features by ensuring its range dweels between
      [0,1] range. This transformation is often used as an alternative
      to the standard scaler. The scaled features are obtained as:
  
      $$
      \mathbf{z} = (\mathbf{x}_{[B,T,C]}-\mathrm{min}({\mathbf{x}})_{[B,1,C]})/
          (\mathrm{max}({\mathbf{x}})_{[B,1,C]}- \mathrm{min}({\mathbf{x}})_{[B,1,C]})
      $$
  
      **Parameters:**<br>
      `x`: torch.Tensor input tensor.<br>
      `mask`: torch Tensor bool, same dimension as `x`, indicates where `x` is valid and False
              where `x` should be masked. Mask should not be all False in any column of
              dimension dim to avoid NaNs from zero division.<br>
      `eps` (float, optional): Small value to avoid division by zero. Defaults to 1e-6.<br>
      `dim` (int, optional): Dimension over to compute min and max. Defaults to -1.<br>
  
      **Returns:**<br>
      `z`: torch.Tensor same shape as `x`, except scaled.
      """
      mask = mask.clone()
      mask[mask == 0] = torch.inf
      mask[mask == 1] = 0
      x_max = torch.max(
          torch.nan_to_num(x - mask, nan=-torch.inf),
          dim=dim,
          keepdim=True,
      )[0]
      x_min = torch.min(
          torch.nan_to_num(x + mask, nan=torch.inf),
          dim=dim,
          keepdim=True,
      )[0]
      x_max = x_max.type(x.dtype)
      x_min = x_min.type(x.dtype)
  
      # x_range and prevent division by zero
      x_range = x_max - x_min
      x_range[x_range == 0] = 1.0
      x_range = x_range + eps
      return x_min, x_range
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 3 for calling a global function with example usage: minmax_statistics(x, mask, eps, dim) and returns: x_min,  x_range