class_docstr: An n-shape binary space.
  
  Elements of this space are binary arrays of a shape that is fixed during construction.
  
  Example Usage::
  
      >>> observation_space = MultiBinary(5)
      >>> observation_space.sample()
          array([0, 1, 0, 1, 0], dtype=int8)
      >>> observation_space = MultiBinary([3, 2])
      >>> observation_space.sample()
          array([[0, 0],
              [0, 1],
              [1, 1]], dtype=int8)
class_docstr_tok: ["An","n-shape","binary","space",".","Elements","of","this","space","are","binary","arrays","of","a","shape","that","is","fixed","during","construction",".","Example","Usage",":",":",">",">",">","observation_space","=","MultiBinary","(","5",")",">",">",">","observation_space.sample","(",")","array","(","[","0",",","1",",","0",",","1",",","0","]",",","dtype=int8",")",">",">",">","observation_space","=","MultiBinary","(","[","3",",","2","]",")",">",">",">","observation_space.sample","(",")","array","(","[","[","0",",","0","]",",","[","0",",","1","]",",","[","1",",","1","]","]",",","dtype=int8",")"]
docstr: Return boolean specifying if x is a valid member of this space.
docstr_tok: ["Return","boolean","specifying","if","x","is","a","valid","member","of","this","space","."]
code: def contains(self, x) -> bool:
      """Return boolean specifying if x is a valid member of this space."""
      if isinstance(x, Sequence):
          x = np.array(x)  # Promote list to array for contains check
  
      return bool(
          isinstance(x, np.ndarray)
          and self.shape == x.shape
          and np.all((x == 0) | (x == 1))
      )
  
file_path: gym/gym/spaces/multi_binary.py
imports: from typing import Optional, Sequence, Tuple, Union
  import numpy
  from gym.spaces.space import Space
label_desc: Use image node_id 5 for calling the MultiBinary obj's underlying member method code with example usage: obj.contains(x) and returns: bool