Solved by tom in post #3 
              
              
                Neither do the Python optimizers take a single tensor. 
You can take pass in a vector of tensors, tough ({dynamic_parameters} might do the trick). 
Best regards 
Thomas