I have seen two different definition of Fidelity in different sources. For example, Nielsen & Chuang QCQI, 10th edition, page 409 defines Fidelity like the following:
$$ F(\rho, \sigma) := \operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}} $$
An implementation of this definition is also present in this QETLAB library.
Another definition that I have found is: $$ F(\rho, \sigma) := \Big(\operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}}\Big)^2 $$ This def is present in the highly regarded Preskill notes and most other places like wiki, quantiki.
Was this definition changed sometime?