'Perform numpy ufunc broadcasting'

def _broadcast(self, arys):

    shapelist = [a.shape for a in arys]
    shape = _multi_broadcast(*shapelist)
    for (i, ary) in enumerate(arys):
        if (ary.shape == shape):
            pass
        elif self.is_device_array(ary):
            arys[i] = self.broadcast_device(ary, shape)
        else:
            ax_differs = [ax for ax in range(len(shape)) if ((ax >= ary.ndim) or (ary.shape[ax] != shape[ax]))]
            missingdim = (len(shape) - len(ary.shape))
            strides = (([0] * missingdim) + list(ary.strides))
            for ax in ax_differs:
                strides[ax] = 0
            strided = np.lib.stride_tricks.as_strided(ary, shape=shape, strides=strides)
            arys[i] = self.force_array_layout(strided)
    return arys
