ImFusion C++ SDK 4.5.0
ImFusion::ML::TensorSetElement Class Reference

#include <ImFusion/ML/DataElements/TensorSetElement.h>

DataElements for Raw Tensors (Experimental) Unlike ImageElements, these elements will go into the ML engine in the shape that they are created (i.e. More...

Inheritance diagram for ImFusion::ML::TensorSetElement:

Detailed Description

DataElements for Raw Tensors (Experimental) Unlike ImageElements, these elements will go into the ML engine in the shape that they are created (i.e.

no shuffling/permuting of shapes) This class is implemented for the Float and Int (int64_t) type The underlying data is stored in a raw std::vector<uint8_t> buffer (m_data) Note: This class is experimental for now, and subject to change

Public Member Functions

 TensorSetElement (std::shared_ptr< TensorSet > tensor)
 Contructor takes a ML::TensorSet and creates a TensorSetElement.
 TensorSetElement (std::shared_ptr< Tensor > tensor)
ElementType type () const override
 Returns the type of the underlying data.
int dimension () const override
 Returns the dimensionality of the underlying data.
size_t batchSize () const override
 Returns the batch size of the element.
std::shared_ptr< TensorSet > tensorSet () const
 Accessors to the underlying tensorSet.
std::shared_ptr< Tensor > tensor (size_t n=0) const
 Accessors to the underlying tensor of frame n in the tensorSet.
void setTensorSet (std::shared_ptr< TensorSet > tensor)
 Sets the underlying Tensor. Throws if tensor is nullptr.
void setContent (std::shared_ptr< Data > tensor) override
 Sets the underlying data. Throws if tensor is nullptr not of type Tensor.
std::unique_ptr< DataElement > clone (CloneOptions opt=CloneOptions::Everything) const override
 Create a (shallow or deep) copy of the element.
std::vector< std::shared_ptr< DataElement > > split () override
 Split an element into several ones along the batch dimension.
Public Member Functions inherited from ImFusion::ML::DataElement
template<typename Derived>
Derived * typed ()
template<typename Derived>
const Derived * typed () const
virtual std::shared_ptr< Data > content () const
 Returns the underlying data object.
const DataComponentList & components () const
 Convenience function to expose the DataComponents of the underlying Data object.
DataComponentList & components ()
bool isTarget () const
 Returns true if this element is marked as a label.
void tagAsTarget ()
 Mark this element as being a label.
void untagAsTarget ()
 Remove label status from this element.

Static Public Member Functions

static std::unique_ptr< DataElement > stack (const std::vector< std::shared_ptr< TensorSetElement > > &elements)
Static Public Member Functions inherited from ImFusion::ML::DataElement
static std::unique_ptr< DataElement > stack (const std::vector< std::shared_ptr< DataElement > > &elements)
 Stack several elements along the batch dimension.

Additional Inherited Members

Public Types inherited from ImFusion::ML::DataElement
enum class  CloneOptions { Everything = 0 , Shallow , Container , NoImageData }
 Option to control which parts of the data element are to be copied when cloning the DataElement. More...
Protected Member Functions inherited from ImFusion::Utils::NotCopyable
 NotCopyable (NotCopyable &&) noexcept=default
NotCopyable & operator= (NotCopyable &&) noexcept=default
 NotCopyable (const NotCopyable &)=delete
NotCopyable & operator= (const NotCopyable &)=delete
Protected Attributes inherited from ImFusion::ML::DataElement
std::shared_ptr< Data > m_data

Constructor & Destructor Documentation

◆ TensorSetElement()

ImFusion::ML::TensorSetElement::TensorSetElement ( std::shared_ptr< TensorSet > tensor)
explicit

Contructor takes a ML::TensorSet and creates a TensorSetElement.

If batchSize is set to 0, the first dimension of the tensor determines the batch size

Member Function Documentation

◆ type()

ElementType ImFusion::ML::TensorSetElement::type ( ) const
inlineoverridevirtual

Returns the type of the underlying data.

Implements ImFusion::ML::DataElement.

◆ dimension()

int ImFusion::ML::TensorSetElement::dimension ( ) const
overridevirtual

Returns the dimensionality of the underlying data.

Implements ImFusion::ML::DataElement.

◆ batchSize()

size_t ImFusion::ML::TensorSetElement::batchSize ( ) const
overridevirtual

Returns the batch size of the element.

Implements ImFusion::ML::DataElement.

◆ setContent()

void ImFusion::ML::TensorSetElement::setContent ( std::shared_ptr< Data > tensor)
overridevirtual

Sets the underlying data. Throws if tensor is nullptr not of type Tensor.

Implements ImFusion::ML::DataElement.

◆ clone()

std::unique_ptr< DataElement > ImFusion::ML::TensorSetElement::clone ( CloneOptions opt = CloneOptions::Everything) const
overridevirtual

Create a (shallow or deep) copy of the element.

Implements ImFusion::ML::DataElement.

◆ split()

std::vector< std::shared_ptr< DataElement > > ImFusion::ML::TensorSetElement::split ( )
overridevirtual

Split an element into several ones along the batch dimension.

After a call to this function, the element is empty.

Implements ImFusion::ML::DataElement.


The documentation for this class was generated from the following file:
  • ImFusion/ML/DataElements/TensorSetElement.h
Search Tab / S to search, Esc to close