Have different instances of the inputs to support inplace ops.
Add tests for blas and fix an missing import in opt.py.