class_docstr: Iid Bernoulli masking distribution.
class_docstr_tok: ["Iid","Bernoulli","masking","distribution","."]
docstr: Sample a mask.
  
  Args:
    pianoroll_shape: shape of pianoroll (time, pitch, instrument)
    separate_instruments: whether instruments are separated
    blankout_ratio: bernoulli inclusion probability
  
  Returns:
    A mask of shape `shape`.
  
  Raises:
    ValueError: if shape is not three dimensional.
docstr_tok: ["Sample","a","mask",".","Args",":","pianoroll_shape",":","shape","of","pianoroll","(","time",",","pitch",",","instrument",")","separate_instruments",":","whether","instruments","are","separated","blankout_ratio",":","bernoulli","inclusion","probability","Returns",":","A","mask","of","shape","`","shape","`",".","Raises",":","ValueError",":","if","shape","is","not","three","dimensional","."]
code: def __call__(
      self,
      pianoroll_shape,
      separate_instruments=True,
      blankout_ratio=0.5,
      **unused_kwargs,
  ):
      """Sample a mask.
  
      Args:
        pianoroll_shape: shape of pianoroll (time, pitch, instrument)
        separate_instruments: whether instruments are separated
        blankout_ratio: bernoulli inclusion probability
  
      Returns:
        A mask of shape `shape`.
  
      Raises:
        ValueError: if shape is not three dimensional.
      """
      if len(pianoroll_shape) != 3:
          raise ValueError(
              "Shape needs to of 3 dimensional, time, pitch, and instrument."
          )
      tt, pp, ii = pianoroll_shape
      if separate_instruments:
          mask = np.random.random([tt, 1, ii]) < blankout_ratio
          mask = mask.astype(np.float32)
          mask = np.tile(mask, [1, pianoroll_shape[1], 1])
      else:
          mask = np.random.random([tt, pp, ii]) < blankout_ratio
          mask = mask.astype(np.float32)
      return mask
  
file_path: magenta/magenta/models/coconet/lib_mask.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from magenta.models.coconet import lib_util
  import numpy
label_desc: Use image node_id 1 for calling the BernoulliMaskoutMethod obj's underlying member method code with example usage: obj.__call__(pianoroll_shape, separate_instruments, blankout_ratio) and returns: mask