Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> To make `Z` a column vector, we would need something like `Z = (Y @ X)[:,np.newaxis]`.

Doesn't just (Y @ X)[None] work? None adding an extra dimension works in practice but I don't know if you're "supposed" to do that





It seems `(Y @ X)[None]` produces a row vector of shape (1,3),

   (Y @ X)[None]
   
   # array([[14, 32, 50]])
   
but `(Y @ X)[None].T` works as you described:

   (Y @ X)[None].T
   
   # array([[14],
   #        [32],
   #        [50]])

I don't know either RE supposed to or not, though I know np.newaxis is an alias for None.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: