fixed a bug in tensor/opt.py exception
Merge pull request #1844 from Hengjean/optExceptionBugFix

fixed a bug in tensor/opt.py exception