def _vector(x, type='row'):
 if isinstance(x, (list, tuple)):
  x = np.array(x, dtype=np.float32)
 elif (not isinstance(x, np.ndarray)):
  x = np.array([x], dtype=np.float32)
 assert (x.ndim == 1)
 if (type == 'column'):
  x = x[:, None]
 return x

def _vector ( x , type = 'row' ) : if isinstance ( x , ( list , tuple ) ) : x = np . array ( x , dtype = np . float32 ) elif ( not isinstance ( x , np . ndarray ) ) : x = np . array ( [ x ] , dtype = np . float32 ) assert ( x . ndim == 1 ) if ( type == 'column' ) : x = x [ : , None ] return x
convert an object to a row or column vector .