That’s very handy! You can also avoid that entirely and just use the broadcasting ops I provided directly, which are largely compatible with numpy / theano / keras / tensorflow: Tip: using keras compatible tensor dot product and broadcasting ops