Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
reshape.hpp File Reference

Explicit aliasing, in-place, and owning tensor reshape operations. More...

#include <uni20/common/trace.hpp>
#include <uni20/mdspan/concepts.hpp>
#include <uni20/mdspan/mdspan.hpp>
#include <uni20/mdspan/mdspec.hpp>
#include <uni20/tensor/basic_tensor.hpp>
#include <uni20/tensor/concepts.hpp>
#include <uni20/tensor/shape.hpp>
#include <array>
#include <concepts>
#include <cstddef>
#include <limits>
#include <memory>
#include <new>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for reshape.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >
 Tensor-level descriptor that resolves a reshape through its parent tensor. More...
 
class  uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >
 Tensor-level descriptor owning a reshaped mdspan and backend selector. More...
 

Namespaces

namespace  uni20
 

Functions

template<class TensorType , std::integral... Extents>
requires detail::StorageTransferReshapableTensor<TensorType, stdex::dextents<index_type, sizeof...(Extents)>>
auto uni20::reshape (TensorType tensor, Extents... requested_extents)
 Return an owning reshape of a canonical dense tensor.
 
template<detail::CanonicallyLaidOutOwningTensor TensorType, std::integral... Extents>
requires (sizeof...(Extents) == tensor_extents_t<TensorType>::rank() && requires(TensorType& tensor, typename TensorType::mapping_type mapping) { tensor.replace_mapping(std::move(mapping)); })
void uni20::reshape_inplace (TensorType &tensor, Extents... requested_extents)
 Change a canonical owning tensor's shape without reallocating storage.
 
template<detail::CanonicallyLaidOutMdspan Span, std::integral... Extents>
auto uni20::reshape_view (Span &&source, Extents... requested_extents)
 Return a no-copy mdspan reshape preserving a canonical source layout.
 
template<ImmediateTensorView Tensor, std::integral... Extents>
requires (std::is_lvalue_reference_v<Tensor &&> && StridedImmediateTensorView<Tensor> && detail::CanonicalReshapeLayout<typename immediate_tensor_mdspan_t<Tensor>::layout_type>)
auto uni20::reshape_view (Tensor &&tensor, Extents... requested_extents)
 Return a tensor-level no-copy reshape preserving a canonical source layout.
 
template<StridedMdspanLike Span, std::integral... Extents>
auto uni20::reshape_view_left (Span &&source, Extents... requested_extents)
 Return a no-copy column-major reshape of a compatible strided mdspan.
 
template<ImmediateTensorView Tensor, std::integral... Extents>
requires (std::is_lvalue_reference_v<Tensor &&> && StridedImmediateTensorView<Tensor>)
auto uni20::reshape_view_left (Tensor &&tensor, Extents... requested_extents)
 Return a tensor-level no-copy column-major reshape of a strided source.
 
template<StridedMdspanLike Span, std::integral... Extents>
auto uni20::reshape_view_right (Span &&source, Extents... requested_extents)
 Return a no-copy row-major reshape of a compatible strided mdspan.
 
template<ImmediateTensorView Tensor, std::integral... Extents>
requires (std::is_lvalue_reference_v<Tensor &&> && StridedImmediateTensorView<Tensor>)
auto uni20::reshape_view_right (Tensor &&tensor, Extents... requested_extents)
 Return a tensor-level no-copy row-major reshape of a strided source.
 

Detailed Description

Explicit aliasing, in-place, and owning tensor reshape operations.