Let $X_n$ be a uniformly integrable sequence of random variables. In a recent question I asked about the possibility of converting Big $O_p$ convergence in probability of the sequence $X_n$ to Big $O$ convergence in expectation. A poster provided a counterexample that shows we can't in general go from Big $O_p$ to Big $O$.
However, on page 4 of these lecture notes the author says that if a sequence of random variables $a_n$ is $O_p(n^d)$ then $E[a_n]$ is $O(n^d)$. Unfortunately the author doesn't give a proof for this statement or state conditions for when it holds.
Clearly the statement in these notes is in direct conflict with the answer to my other question. So either the author is mistaken in his statement or it raises the possibility that we can indeed convert Big $O_p$ convergence in probability to Big $O$ convergence in expectation.
So my question now is, what are sufficient and necessary conditions for a sequence of random variables $a_n$ such that the authors statement is true? That is, what are the conditions needed on $a_n$ such that $$ a_n = O_p(n^d) \implies E[a_n] = O(n^d). $$