Solved by zdevito in post #3 
              
              
                The problem here is that [1,2,3] is a list of integers not a list of floats. If it is changed to [1.0, 2.0, 3.0], it should work. I submitted https://github.com/pytorch/pytorch/pull/31375 to make the error message report correctly.