Writing a question in Meta asking for feedback is a way to solicit feedback.
The blue box at the top of your post reads "Closed. This question needs details or clarity. It is not currently accepting answers.
Add details and clarify the problem being solved. This will help others answer the question. You can edit the question." This is the feedback.
I didn't vote to close the question, so I can't speak for the people who did. However, there are several parts of the question that could be clarified.
The question is completely general. You want to compute an expectation of an arbitrary function where neither $P$ nor $f$ are described. Often, solving a very general problem is harder than solving a more specific problem; providing detail about what you want to do and how the proposed procedure fits into it could make the answer more tractable.
In general, estimating posterior distributions is challenging. It becomes more challenging when estimating very many parameters and highly multimodal and non-identified likelihoods, such as neural networks. Bayesian inference tools exist to estimate posterior distributions, but it's not clear from the question whether you are using them at all, or if you are conflating them with SGD.
You describe SGD as "sampling parameters," which is not what SGD is. SGD does not generate random deviates from a desired target distribution. SGD is an optimization algorithm. The purpose of SGD is to adjust parameters $\theta$ so that some loss achieves a local minimum. When the SGD loss is a negative likelihood, then it is analogous to a maximum likelihood estimator; both are point estimates of parameters given a dataset and a model specification.
Bayesian neural networks are a specialized topic in their own right. It's possible that this is what you're after, since you're using a neural network and desire estimates of distributions over $\theta$. If you are asking about Bayesian neural networks, then this question is very broad and would benefit from an explanation of what you know and what you would like to find out.
It's possible that you have some specialized procedure in mind that resolves these inconsistencies and ambiguities. If so, you should edit your question to describe them.