Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents > Class Template Reference

Tensor-level descriptor that resolves a reshape through its parent tensor. More...

#include <reshape.hpp>

Public Types

using async_alias_tag = void
 
using backend_selector_type = std::remove_cvref_t< decltype(std::declval< tensor_type const & >().backend_selector())>
 
using const_mdspec_type = decltype(detail::make_reshape_view< LayoutPolicy >(mdspec_of(std::declval< tensor_type const & >()), std::declval< RequestedExtents >()...))
 
using element_type = typename mdspec_type::element_type
 
using extents_type = typename mdspec_type::extents_type
 
using index_type = typename mdspec_type::index_type
 
using layout_type = typename mdspec_type::layout_type
 
using mapping_type = typename mdspec_type::mapping_type
 
using mdspec_type = decltype(detail::make_reshape_view< LayoutPolicy >(mdspec_of(std::declval< tensor_type & >()), std::declval< RequestedExtents >()...))
 
using requested_extents_type = std::tuple< RequestedExtents... >
 
using storage_policy = tensor_storage_policy_t< std::remove_cv_t< tensor_type > >
 
using tensor_type = std::remove_reference_t< Tensor >
 
using value_type = typename mdspec_type::value_type
 

Public Member Functions

constexpr decltype(auto) backend_selector () const
 Return the source storage's backend selector.
 
tensor_type const & base () const noexcept
 Return the tensor referenced by this descriptor.
 
tensor_type & base () noexcept
 Return the tensor referenced by this descriptor.
 
auto extent (std::size_t axis) const -> index_type
 Return one reshaped extent.
 
auto extents () const -> extents_type
 Return the reshaped extents.
 
 IndirectReshapedTensorView (tensor_type &tensor, RequestedExtents... requested_extents)
 Bind and immediately validate a reshape of an existing tensor.
 
 IndirectReshapedTensorView (tensor_type *tensor, RequestedExtents... requested_extents)
 Bind a reshape to externally retained tensor storage.
 
auto mdspan () &-> mdspec_type
 Resolve the reshaped mdspan when the parent is immediately accessible.
 
auto mdspan () const &-> const_mdspec_type
 Resolve the read-only reshaped mdspan when the parent is immediately accessible.
 
auto mdspec () &-> mdspec_type
 Return the reshaped immediate or deferred metadata with source mutability.
 
auto mdspec () const &-> const_mdspec_type
 Return the reshaped immediate or deferred metadata for read-only access.
 
template<class... Index>
requires MdspanLike<mdspec_type> && (sizeof...(Index) == extents_type::rank())
decltype(auto) operator[] (Index... indices)
 Evaluate or assign one reshaped element according to source mutability.
 
template<class... Index>
requires MdspanLike<const_mdspec_type> && (sizeof...(Index) == extents_type::rank())
decltype(auto) operator[] (Index... indices) const
 Evaluate one reshaped element through the read-only accessor.
 

Detailed Description

template<class Tensor, detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
requires TensorView<Tensor> && StridedTensorView<Tensor>
class uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >

Tensor-level descriptor that resolves a reshape through its parent tensor.

The descriptor aliases the same element storage as its source and preserves source mutability. Parent indirection allows an async alias to bind reserved storage before the parent value is constructed.

Member Typedef Documentation

◆ async_alias_tag

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::async_alias_tag = void

◆ backend_selector_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::backend_selector_type = std::remove_cvref_t<decltype(std::declval<tensor_type const&>().backend_selector())>

◆ const_mdspec_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::const_mdspec_type = decltype(detail::make_reshape_view<LayoutPolicy>( mdspec_of(std::declval<tensor_type const&>()), std::declval<RequestedExtents>()...))

◆ element_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::element_type = typename mdspec_type::element_type

◆ extents_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::extents_type = typename mdspec_type::extents_type

◆ index_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::index_type = typename mdspec_type::index_type

◆ layout_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::layout_type = typename mdspec_type::layout_type

◆ mapping_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mapping_type = typename mdspec_type::mapping_type

◆ mdspec_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mdspec_type = decltype(detail::make_reshape_view<LayoutPolicy>(mdspec_of(std::declval<tensor_type&>()), std::declval<RequestedExtents>()...))

◆ requested_extents_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::requested_extents_type = std::tuple<RequestedExtents...>

◆ storage_policy

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::storage_policy = tensor_storage_policy_t<std::remove_cv_t<tensor_type> >

◆ tensor_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::tensor_type = std::remove_reference_t<Tensor>

◆ value_type

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
using uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::value_type = typename mdspec_type::value_type

Constructor & Destructor Documentation

◆ IndirectReshapedTensorView() [1/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::IndirectReshapedTensorView ( tensor_type &  tensor,
RequestedExtents...  requested_extents 
)
inline

Bind and immediately validate a reshape of an existing tensor.

◆ IndirectReshapedTensorView() [2/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::IndirectReshapedTensorView ( tensor_type *  tensor,
RequestedExtents...  requested_extents 
)
inlineexplicit

Bind a reshape to externally retained tensor storage.

Warning
The pointer may identify reserved but unconstructed storage; callers must not resolve the view until the parent epoch is readable.

Member Function Documentation

◆ backend_selector()

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
constexpr decltype(auto) uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::backend_selector ( ) const
inlineconstexpr

Return the source storage's backend selector.

◆ base() [1/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
tensor_type const & uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::base ( ) const
inlinenoexcept

Return the tensor referenced by this descriptor.

◆ base() [2/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
tensor_type & uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::base ( )
inlinenoexcept

Return the tensor referenced by this descriptor.

◆ extent()

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::extent ( std::size_t  axis) const -> index_type
inline

Return one reshaped extent.

◆ extents()

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::extents ( ) const -> extents_type
inline

Return the reshaped extents.

◆ mdspan() [1/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mdspan ( ) & -> mdspec_type
inline

Resolve the reshaped mdspan when the parent is immediately accessible.

◆ mdspan() [2/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mdspan ( ) const & -> const_mdspec_type
inline

Resolve the read-only reshaped mdspan when the parent is immediately accessible.

◆ mdspec() [1/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mdspec ( ) & -> mdspec_type
inline

Return the reshaped immediate or deferred metadata with source mutability.

◆ mdspec() [2/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
auto uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::mdspec ( ) const & -> const_mdspec_type
inline

Return the reshaped immediate or deferred metadata for read-only access.

◆ operator[]() [1/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
template<class... Index>
requires MdspanLike<mdspec_type> && (sizeof...(Index) == extents_type::rank())
decltype(auto) uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::operator[] ( Index...  indices)
inline

Evaluate or assign one reshaped element according to source mutability.

◆ operator[]() [2/2]

template<class Tensor , detail::CanonicalReshapeLayout LayoutPolicy, std::integral... RequestedExtents>
template<class... Index>
requires MdspanLike<const_mdspec_type> && (sizeof...(Index) == extents_type::rank())
decltype(auto) uni20::IndirectReshapedTensorView< Tensor, LayoutPolicy, RequestedExtents >::operator[] ( Index...  indices) const
inline

Evaluate one reshaped element through the read-only accessor.


The documentation for this class was generated from the following file: