fixed a bug in tensor/opt.py exception