while playing some more with diagonal and GPU tensors I stumbled upon a few more odd things, I don’t know if should open a new thread or add them here, since they seem to belong somehow to the same family of errors. Or if you prefer me to file bug reports for this kind of stuff let me know!
I’m attaching below the full MWE with a list of examples that don’t work, but long story short I’m getting “Scalar indexing is disallowed” errors when I calculate the sum()
of a cuda tensor, and also when computing a product of the form Aij*Dji
, where D is a diagonal cuda tensor (whereas it works if D is not diagonal)
Probably unrelated, I saw there is a tr()
function for ITensors, but that doesn’t work for me (neither for cpu nor gpu tensors). Since I couldn’t find any doc for it, I imagine it’s not recommended for use.
using ITensors, CUDA
gpu = NDTensors.cu
ij = (Index(3), Index(3))
jk = (ij[2], Index(3))
aij= random_itensor(ij)
bjk = random_itensor(jk)
cij = random_itensor(ij)
djk = diag_itensor([1,2,3.0+im],jk)
cua = gpu(aij)
cub = gpu(bjk)
cuc = gpu(cij)
cud = gpu(djk)
cua * cub # ok, rank2
cua * cuc # ok, rank0
cua * cud # ok, rank2
cub * cud #ERROR: Scalar indexing is disallowed.
sum(aij) # ok, scalar
sum(djk) # ok, scalar
sum(cua) #ERROR: Scalar indexing is disallowed.
sum(cud) #ERROR: Scalar indexing is disallowed.
tr(aij) # ERROR: MethodError: no method matching checkdims_perm(::NDTensors.DenseTensor{Float64, 3, Tuple{…}, NDTensors.Dense{…}}, ::NDTensors.DenseTensor{Float64, 2, Tuple{…}, NDTensors.Dense{…}}, ::Tuple{Int64, Int64, Int64})
tr(djk) # ERROR: MethodError: no method matching checkdims_perm(::NDTensors.DenseTensor{…}, ::NDTensors.DenseTensor{…}, ::Tuple{…})
tr(cua) # ERROR: MethodError: no method matching checkdims_perm(::NDTensors.DenseTensor{Float64, 3, Tuple{…}, NDTensors.Dense{…}}, ::NDTensors.DenseTensor{Float64, 2, Tuple{…}, NDTensors.Dense{…}}, ::Tuple{Int64, Int64, Int64})
tr(cud) #ERROR: MethodError: no method matching checkdims_perm(::NDTensors.DenseTensor{…}, ::NDTensors.DenseTensor{…}, ::Tuple{…})
thanks!