Solved by SplitInfinity in post #4 
              
              
                My earlier statement was not completely accurate. __exit__ is allowed to return anything that can be interpreted as a boolean, which includes certain kinds of Tensors.