Skip to content

Commit 99bcd4b

Browse files
committed
Adapt to some more changes in 526
1 parent 5c375e8 commit 99bcd4b

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎ext/TensorKitGPUArraysExt.jl‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,24 +236,31 @@ function DeviceGenericTreeTransformer(
236236
structs_dst = TreeStructure{N}[]
237237
structs_src = TreeStructure{N}[]
238238

239-
for (U, (size_dst, strides_dst), (size_src, strides_src)) in transformer.data
239+
(; structure_dst, structure_src) = transformer
240+
for (U, inds_dst, inds_src) in transformer.data
240241
if length(U) == 1 # same as the unique (Abelian) case
241242
push!(
242243
degenerate, _unique_block(
243-
only(U), (size_dst, only(strides_dst)...), (size_src, only(strides_src)...), p
244+
only(U), structure_dst[only(inds_dst)], structure_src[only(inds_src)], p
244245
)
245246
)
246247
else
248+
# all trees in a block share the same subblock size
249+
size_dst = first(structure_dst[first(inds_dst)])
247250
push!(
248251
blocks, GenericTransformerBlock{N}(
249252
size_dst, _dense_strides(size_dst), size(U, 1), size(U, 2),
250253
length(coeffs), length(structs_dst), length(structs_src)
251254
)
252255
)
253256
append!(coeffs, U)
254-
append!(structs_dst, strides_dst)
255-
for (stride_src, offset_src) in strides_src
256-
push!(structs_src, (TupleTools.getindices(stride_src, p), offset_src))
257+
for idst in inds_dst
258+
_, strides_dst, offset_dst = structure_dst[idst]
259+
push!(structs_dst, (strides_dst, offset_dst))
260+
end
261+
for isrc in inds_src
262+
_, strides_src, offset_src = structure_src[isrc]
263+
push!(structs_src, (TupleTools.getindices(strides_src, p), offset_src))
257264
end
258265
end
259266
end

0 commit comments

Comments
 (0)