Skip to content

Commit

Permalink
Add (alias, zeros) function
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed Aug 1, 2023
1 parent 412c878 commit 861cedf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NDTensors/src/zeros/zeros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ setindex!(A::NDTensors.Zeros, v, I) = setindex!(A.z, v, I)

Base.iszero(t::Tensor) = iszero(storage(t))
Base.iszero(st::TensorStorage) = data(st) isa Zeros

function (arraytype::Type{<:Zeros})(::AllowAlias, A::Zeros)
return A
end

function (arraytype::Type{<:Zeros})(::NeverAlias, A::Zeros)
return copy(A)
end

0 comments on commit 861cedf

Please sign in to comment.