Autodifferentiating through the second Rényi entropy

Hi, I have a question about making some code AD-compatible (I am taking the gradient of an ITensor using Zygote). Ordinarily, I would compute the second entropy using this code:

function second_Renyi_entropy(ρ::MPO)
    return -log(tr(apply(ρ, ρ)))
end

However, this throws a pullback error somewhere along the chain. To that end, I tried to write my own AD-compatible code to compute the second Rényi entropy of an MPO:

function second_Renyi_entropy_AD(ρ::MPO)
    T = ρ[1] * ρ[1]
    for i in 2:length(ρ)
        T *= (ρ[i] * ρ[i])
    end
    T = array(T)[1]
    return -log(T)
end

However, this second approach is not giving me the same result as the first, which leads me to believe that I am doing something naive & wrong. Please let me know if you have any thoughts!