I know, this may seem as a bit of a weird question. As we know that the relation between force and potential energy i.e: $$F = -\frac{\text{d}U}{\text{d}x}$$ so can we say that relation between torque about an axis and potential energy to be: $$\tau = -\frac{\text{d}U}{\text{d}\theta}$$
Any help would be appreciated.