Skip to content

Commit d0404ce

Browse files
committed
update docstrings
1 parent 9122572 commit d0404ce

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/sampling.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The backward process for sampling configurations.
3232
3333
* `ixs` and `xs` are labels and tensor data for input tensors,
3434
* `iy` and `y` are labels and tensor data for the output tensor,
35-
* `ysamples` is the samples generated on the output tensor,
35+
* `samples` is the samples generated for eliminated variables,
3636
* `size_dict` is a key-value map from tensor label to dimension size.
3737
"""
3838
function backward_sampling!(ixs, @nospecialize(xs::Tuple), iy, @nospecialize(y), samples::Samples, size_dict)
@@ -72,9 +72,14 @@ end
7272
"""
7373
$(TYPEDSIGNATURES)
7474
75-
Sample a tensor network based probabilistic model.
75+
Generate samples from a tensor network based probabilistic model.
76+
Returns a vector of vector, each element being a configurations defined on `get_vars(tn)`.
77+
78+
### Arguments
79+
* `tn` is the tensor network model.
80+
* `n` is the number of samples to be returned.
7681
"""
77-
function sample(tn::TensorNetworkModel, n::Int; usecuda = false)::Samples
82+
function sample(tn::TensorNetworkModel, n::Int; usecuda = false)::Vector{Vector{Int}}
7883
# generate tropical tensors with its elements being log(p).
7984
xs = adapt_tensors(tn; usecuda, rescale = false)
8085
# infer size from the contraction code and the input tensors `xs`, returns a label-size dictionary.

0 commit comments

Comments
 (0)