Using pm.DensityDist and customized likelihood with a black-box function

You probably need to wrap your blackbox function with as_op. For example, see a similar discussion in Connecting PyMC3 to external code - help with understanding Theano custom Ops and more in https://discourse.pymc.io/search?q=as_op