PEP8/flake8 fixes in tensor/basic.py

Remaining errors are lines too long in comments or C code.
this could break code. But it is probably fine.