PEP8/flake8 fixes in tensor/basic.py

Remaining errors are lines too long in comments or C code.