You are not checking the storage_offset and stride informations.
Given that the first value is correct but not the other one, I would guess that this is a non-contiguous Tensor and you should use the stride to read it properly.
Doing upstreamGrad.contiguous().data_ptr() should give you the right result.