22#include <torch/torch.h>
46template <
bool transpose = false>
53 .repeat(index.numel());
58 .repeat_interleave(index.numel());
71template <
bool transpose = false, std::
size_t N>
79 for (std::size_t
i = 1;
i <
N; ++
i)
96 if constexpr (
N == 2) {
97 return index[0].repeat_interleave(
dist[0]).repeat_interleave(
101 .repeat(index[1].
numel())
104 return index[0].repeat_interleave(
dist[0]).repeat_interleave(
108 .repeat(index[0].
numel())
125 auto vslice_ = [&]<std::size_t...
Is>(std::index_sequence<
Is...>) {
129 return vslice_(std::make_index_sequence<N>{});
138 .repeat_interleave(index[0].
numel() *
142 if constexpr (
N == 2) {
146 .repeat_interleave(index[0].
numel()))
152 .repeat_interleave(index[0].
numel()))
159 .repeat_interleave(index[0].
numel() *
167 auto vslice_ = [&]<std::size_t...
Is>(std::index_sequence<
Is...>) {
171 return vslice_(std::make_index_sequence<N>{});
Linear algebra utility functions.
std::array< torch::Tensor, N > TensorArray
Definition tensorarray.hpp:28
T prod(std::array< T, N > array, std::size_t start_index=0, std::size_t stop_index=N - 1)
Computes the (partial) product of all std::array entries.
Definition linalg.hpp:221
auto VSlice(torch::Tensor index, int64_t start_offset, int64_t stop_offset)
Vectorized version of torch::indexing::Slice (see https://pytorch.org/cppdocs/notes/tensor_indexing....
Definition vslice.hpp:47
Definition boundary.hpp:22
constexpr bool is_SplineType_v
Alias to the value of is_SplineType.
Definition bspline.hpp:3243
TensorArray utility functions.