Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ITensors] Fix broken broadcast operation on GPU #1532

Merged
merged 19 commits into from
Oct 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions NDTensors/test/test_dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ NDTensors.dim(i::MyInd) = i.dim
@test A[2, 2] == Aview[1, 1]
end

## Testing A .= α .* B .+ β .* A
C = copy(A)
@allowscalar fill!(B, zero(elt))
β = elt(2.0)
α = elt(1.0)
kmp5VT marked this conversation as resolved.
Show resolved Hide resolved
permutedims!!(A, B, (1, 2), (a, b) -> +(*(β, a), *(α, b)))
@allowscalar 2.0 .* C == A
kmp5VT marked this conversation as resolved.
Show resolved Hide resolved
randn!(B)
C = copy(A)
A = permutedims!!(A, B, (1, 2), (a, b) -> +(*(β, a), *(α, b)))
@allowscalar for i in 1:3, j in 1:4
@test A[i, j] == α * B[i, j] + β * C[i, j]
end

## add elt around 2.0 to preserve the eltype of A.
@test data(A * elt(2.0)) == data(elt(2.0) * A)

Expand Down
Loading