There is a YouTube lecture by Robert Dijkgraaf titled:"Introduction to Topological and Conformal Field Theory (1 of 2)."
https://www.youtube.com/watch?v=jEEQO-tcyHc&t=2977s
At one point he obtains partition function by taking usual trace but before that he also defines it as a function that takes closed manifolds as input and a complex number as output. In fact, this is how Dan Freed also defines the partition funtion.
https://web.ma.utexas.edu/users/dafr/CBMS133.pdf
I am a bit confused since taking trace only gives a Tori and that is what appear on N-lab.
They are defining it for a general n-dimensional theories (if I haven't misunderstood). There is no such classification therorem in dimension greater than 2 that can tell us that all closed n-manifolds (other than spheres) can be obtained by gluing two ends.