You need to understand broadcasting semantics for that. It can be a bit tricky in the beginning to wrap your head around it. A good starting point are the docs 12 on this topic (especially the first section).