Skip to content

Commit

Permalink
Fix rand on TensorNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Sep 13, 2024
1 parent 72ea6d6 commit 58e44f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TensorNetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,10 @@ function Base.rand(
return TensorNetwork(tensors)
end

function Base.rand(::Type{TensorNetwork}, n::Integer, regularity::Integer; kwargs...)
return rand(Random.default_rng(), TensorNetwork, n, regularity; kwargs...)
end

function Serialization.serialize(s::AbstractSerializer, obj::TensorNetwork)
Serialization.writetag(s.io, Serialization.OBJECT_TAG)
return serialize(s, tensors(obj))
Expand Down

0 comments on commit 58e44f1

Please sign in to comment.