Implement type inference for ufunc.accumulate