Let $p,q$ be two distributions on $\mathbb{R}^d$. Let $f:\mathbb{R}^d\times\mathbb{R}^d\rightarrow\mathbb{R}$. Under what conditions does $\mathbb{E}_{x\sim p}f(x,z)=\mathbb{E}_{x\sim q}f(x,z)\ \forall z\in\mathbb{R}^d$ indicate $p=q$ a.e.? For example, can we prove $p=q$ a.e. when $f(x,z)=\tanh(x^{\top}z)$?
(Note: this problem may be related to discriminatory functions such as sigmoidal functions, but two distributions are involved in this case.)