BUG FIX: fixed over eager type checking. Should only compare (dtype, ndim),
since GPU optimizations may change the actual type from TensorType to
CudaNdArray (but with correct dtype and ndim).