How to convert Ufl objects to pytorch tensor?

Interpolate said tensor into a Quadrature space. See for instance: Mapped quadrature points, weights and solution at these quadrature points - #4 by dokken

You could use @a-latyshev’s external operator: