In general the outputs have to share the ground with the inputs in audio amplifiers.
However, a lot of effort is needed to ensure that the high-currents flowing in the output do not contaminate the input signal.
Usually this means using a star-grounding where a common point is selected and input grounds and output grounds emanate from that point but no conductors have both the output current and input reference.
For devices such as the TPA3123D2 the manufacturer will have designed it with these constrains and their design recommendations should be followed. Such recommendations are usually in the data sheet or application notes.
See page 17 on the data sheet (TPA3123D2 datasheet)
Datasheet excerpt:
- Grounding—The AVCC (pins 19 and 20) decoupling capacitor and VBYP
(pin 7) capacitor should each be grounded to analog ground (AGND,
pins 8 and 9). The PVCCx decoupling capacitors and VCLAMP capacitors
should each be grounded to power ground (PGND, pins 13, 14, 23, and
24). Analog ground and power ground should be connected at the
thermal pad, which should be used as a central ground connection or
star ground for the TPA3123D2.