Solved by thatgeeman in post #2 
              
              
                Alright! so this was simply due to the fact that the list comprehension puts eval in a different scope altogether! It was not a pytorch specific issue: python - eval fails in list comprehension - Stack Overflow!