Skip to content

Commit

Permalink
Adding a docstring for _create_view.
Browse files Browse the repository at this point in the history
  • Loading branch information
codetalker7 committed Jul 25, 2024
1 parent 7a8ebb1 commit 977a5c5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/search/strided_tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ function _select_strides(lengths::Vector{Int}, quantiles::Vector{Float64})
end
end

"""
_create_view(tensor::Vector{Int}, stride::Int)
Create a view into `tensor`, where each column of the view corresponds to a slice of size `stride` in the original tensor.
# Arguments
- `tensor`: The input `Vector` to create views of.
- `stride`: The number of elements to include in each slice of the output tensor.
# Returns
An array of shape `(stride, outdim)`, where each column is a slice of size `stride` from the original tensor, and `outdim = length(tensor) - stride + 1`.
"""
function _create_view(tensor::Vector{Int}, stride::Int)
outdim = length(tensor) - stride + 1
size = (stride, outdim)
Expand Down

0 comments on commit 977a5c5

Please sign in to comment.