parameters: (pattern: np.array, shape: np.array)
return_statement: return np.ma.allequal(pattern[indices], shape[indices])
docstring: Check if shape matches shape pattern handling undefined dimension and 0 in the pattern.
docstring_summary: Check if shape matches shape pattern handling undefined dimension and 0 in the pattern.
docstring_tokens: Check if shape matches shape pattern handling undefined dimension and 0 in the pattern .
function: def match_shapes(pattern: np.array, shape: np.array):
      """ Check if shape matches shape pattern handling undefined dimension and 0 in the pattern. """
      # Elements with value 0 and undefined values in pattern are just ignored. Other elements should match.
      if pattern.size != shape.size:
          return False
      indices = [i for i, n in enumerate(pattern) if n != 0 and n is not dynamic_dimension]
      return np.ma.allequal(pattern[indices], shape[indices])
function_tokens: def match_shapes ( pattern : np . array , shape : np . array ) : # Elements with value 0 and undefined values in pattern are just ignored. Other elements should match. if pattern . size != shape . size : return False indices = [ i for i , n in enumerate ( pattern ) if n != 0 and n is not dynamic_dimension ] return np . ma . allequal ( pattern [ indices ] , shape [ indices ] )