Tensor Tiling Library
 
Loading...
Searching...
No Matches
TTL_sub_tensor< TENSORTYPE > Struct Template Reference

A tensor plus its reference to its parent tensor. More...

#include <TTL_tensors.h>

Collaboration diagram for TTL_sub_tensor< TENSORTYPE >:

Data Structures

struct  Origin
 

Public Member Functions

 TTL_sub_tensor (TENSORTYPE *base, const TTL_shape &shape, const TTL_layout &layout, const TTL_dim elem_size, const TTL_offset offset, const TTL_shape origin_shape, TTL_offset origin_offset)
 TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _7_params)
 
 TTL_sub_tensor (TENSORTYPE *const base, const TTL_shape &shape, const TTL_layout &layout, const TTL_tensor< TENSORTYPE > &origin_tensor, const TTL_offset &sub_offset)
 TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _5_params)
 
 TTL_sub_tensor (TENSORTYPE const base, const TTL_tensor< TENSORTYPE > &origin_tensor)
 TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _2_params)
 
 TTL_sub_tensor (const TTL_tensor< TENSORTYPE > &origin_tensor)
 TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _1_param)
 
 TTL_sub_tensor ()
 Create an empty tiled internal tensor. Empty means it has all dimensions set to zero.
 
const TENSORTYPE & read (const unsigned int x, const unsigned int y=0, const unsigned int z=0) const
 Read a value from a sub_tensor.
 
TENSORTYPE write (const TENSORTYPE value, const unsigned int x, const unsigned int y=0, const unsigned int z=0)
 Write a value to a sub_tensor.
 
bool empty ()
 A Tensor is empty if its shape is empty.
 

Data Fields

TTL_tensor< TENSORTYPE > tensor
 
Origin origin
 

Detailed Description

template<typename TENSORTYPE>
struct TTL_sub_tensor< TENSORTYPE >

A tensor plus its reference to its parent tensor.

TTL_sub_tensor contains both the logical dimensions of a tile as well as its physical mapping to memory.

Parameters
TTL_scopeThe scope of the creation can be TTL_global or TTL_local
const_1The const name to place after the prefix - should be empty or const_
locationThe location of the tensor - should be ext or int
typeThe type of the tensor - should be any valid c type
const_2The const type to create - should be empty or const

Definition at line 275 of file TTL_cpp/TTL_tensors.h.

Constructor & Destructor Documentation

◆ TTL_sub_tensor() [1/5]

template<typename TENSORTYPE>
TTL_sub_tensor< TENSORTYPE >::TTL_sub_tensor ( TENSORTYPE * base,
const TTL_shape & shape,
const TTL_layout & layout,
const TTL_dim elem_size,
const TTL_offset offset,
const TTL_shape origin_shape,
TTL_offset origin_offset )
inline

TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _7_params)

Parameters
baseThe ## TTL_scope ## base address of the tensor in ## location ## memory
shapeDescription of the shape of the tensor that base points
layoutThe layout of the ## location ## tensor
elem_sizeThe size of a single element in the
offsetThe offset of the tensor from the base.
See also
TTL_offset
Parameters
origin_shapeThe shape of the tensor that originated the sub tensor
origin_offsetThe offset of the tensor from the souce tensor.
See also
TTL_offset
Returns
return a TTL_sub_tensor(TTL_, const_1, location, type, sub, _t)

Definition at line 289 of file TTL_cpp/TTL_tensors.h.

◆ TTL_sub_tensor() [2/5]

template<typename TENSORTYPE>
TTL_sub_tensor< TENSORTYPE >::TTL_sub_tensor ( TENSORTYPE *const base,
const TTL_shape & shape,
const TTL_layout & layout,
const TTL_tensor< TENSORTYPE > & origin_tensor,
const TTL_offset & sub_offset )
inline

TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _5_params)

Parameters
baseThe ## TTL_scope ## base address of the tensor in ## location ## memory
shapeDescription of the shape of the tensor that base points
layoutThe layout of the ## location ## tensor
origin_tensorThe tensor that originated the sub tensor
sub_offsetThe offset of the tensor from the souce tensor.
See also
TTL_offset

The element size of the tensor is taken from the origin tensor The offset of the sub tensor is taken to be (0, 0, 0)

Returns
return a TTL_sub_tensor(TTL_, const_1, location, type, sub, _t)

Definition at line 308 of file TTL_cpp/TTL_tensors.h.

◆ TTL_sub_tensor() [3/5]

template<typename TENSORTYPE>
TTL_sub_tensor< TENSORTYPE >::TTL_sub_tensor ( TENSORTYPE const base,
const TTL_tensor< TENSORTYPE > & origin_tensor )
inline

TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _2_params)

Simply create a sub_tensor from an origin tensor

Parameters
baseThe ## TTL_scope ## base address of the tensor in ## location ## memory
origin_tensorThe tensor that originated the sub tensor

The element size of the tensor is taken from the origin tensor The offset of the sub tensor is taken to be (0, 0, 0) The offset of the sub tensor relative to the source tensor is taken to be (0, 0, 0)

Returns
return a TTL_sub_tensor(TTL_, const_1, location, type, sub, _t)

Definition at line 327 of file TTL_cpp/TTL_tensors.h.

◆ TTL_sub_tensor() [4/5]

template<typename TENSORTYPE>
TTL_sub_tensor< TENSORTYPE >::TTL_sub_tensor ( const TTL_tensor< TENSORTYPE > & origin_tensor)
inline

TTL_sub_tensor(TTL_create_, const_1, location, type, sub, _1_param)

Simply create a sub_tensor from an origin tensor

Parameters
origin_tensorThe tensor that originated the sub tensor

Effective creates a sub-tensor that is a tensor covering 100% of the source tensor

Returns
return a TTL_sub_tensor(TTL_, const_1, location, type, sub, _t)

Definition at line 343 of file TTL_cpp/TTL_tensors.h.

◆ TTL_sub_tensor() [5/5]

template<typename TENSORTYPE>
TTL_sub_tensor< TENSORTYPE >::TTL_sub_tensor ( )
inline

Create an empty tiled internal tensor. Empty means it has all dimensions set to zero.

Most operations on an empty tensor should turn into no-ops and so an empty tensor is the safest default state.

Definition at line 354 of file TTL_cpp/TTL_tensors.h.

Member Function Documentation

◆ empty()

template<typename TENSORTYPE>
bool TTL_sub_tensor< TENSORTYPE >::empty ( )
inline

A Tensor is empty if its shape is empty.

See also
TTL_shape_empty
Parameters
tensorThe tensor to test for emptiness
Returns
true is the tensor is empty
false is the tensor is not empty

Definition at line 391 of file TTL_cpp/TTL_tensors.h.

◆ read()

template<typename TENSORTYPE>
const TENSORTYPE & TTL_sub_tensor< TENSORTYPE >::read ( const unsigned int x,
const unsigned int y = 0,
const unsigned int z = 0 ) const
inline

Read a value from a sub_tensor.

Parameters
xThe offset in the x dimension
yThe offset in the y dimension
zThe offset in the z dimension

No bounds checking is performed.

Returns
The value read

Definition at line 367 of file TTL_cpp/TTL_tensors.h.

◆ write()

template<typename TENSORTYPE>
TENSORTYPE TTL_sub_tensor< TENSORTYPE >::write ( const TENSORTYPE value,
const unsigned int x,
const unsigned int y = 0,
const unsigned int z = 0 )
inline

Write a value to a sub_tensor.

Parameters
valueThe value to write
xThe offset in the x dimension
yThe offset in the y dimension
zThe offset in the z dimension

Definition at line 379 of file TTL_cpp/TTL_tensors.h.

Field Documentation

◆ origin

template<typename TENSORTYPE>
Origin TTL_sub_tensor< TENSORTYPE >::origin

Definition at line 408 of file TTL_cpp/TTL_tensors.h.

◆ tensor

template<typename TENSORTYPE>
TTL_tensor<TENSORTYPE> TTL_sub_tensor< TENSORTYPE >::tensor

Definition at line 407 of file TTL_cpp/TTL_tensors.h.


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