MLCompilerBridge
Tools for streamlining communication with ML models for compiler optimizations.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MLBridge::TensorSpec Class Referencefinal

#include <TensorSpec.h>

Public Member Functions

const std::string & name () const
 
int port () const
 
TensorType type () const
 
const std::vector< int64_t > & shape () const
 
void setShape (const std::vector< int64_t > &NewShape)
 
bool operator== (const TensorSpec &Other) const
 
bool operator!= (const TensorSpec &Other) const
 
size_t getElementCount () const
 Get the number of elements in a tensor with this shape.
 
size_t getElementByteSize () const
 Get the size, in bytes, of one element.
 
size_t getTotalTensorBufferSize () const
 Get the total size of a memory buffer needed to store the whole tensor.
 
template<typename T >
bool isElementType () const
 
 TensorSpec (const std::string &NewName, const TensorSpec &Other)
 
void toJSON (llvm::json::OStream &OS) const
 

Static Public Member Functions

template<typename T >
static TensorSpec createSpec (const std::string &Name, const std::vector< int64_t > &Shape, int Port=6020)
 

Private Member Functions

 TensorSpec (const std::string &Name, int Port, TensorType Type, size_t ElementSize, const std::vector< int64_t > &Shape)
 

Static Private Member Functions

template<typename T >
static TensorType getDataType ()
 

Private Attributes

std::string Name
 
int Port = 0
 
TensorType Type = TensorType::Invalid
 
std::vector< int64_tShape
 
size_t ElementCount = 0
 
size_t ElementSize = 0
 

Detailed Description

Definition at line 53 of file TensorSpec.h.

Constructor & Destructor Documentation

◆ TensorSpec() [1/2]

MLBridge::TensorSpec::TensorSpec ( const std::string & NewName,
const TensorSpec & Other )
inline

Definition at line 89 of file TensorSpec.h.

◆ TensorSpec() [2/2]

MLBridge::TensorSpec::TensorSpec ( const std::string & Name,
int Port,
TensorType Type,
size_t ElementSize,
const std::vector< int64_t > & Shape )
private

Definition at line 61 of file TensorSpec.cpp.

Member Function Documentation

◆ createSpec()

template<typename T >
static TensorSpec MLBridge::TensorSpec::createSpec ( const std::string & Name,
const std::vector< int64_t > & Shape,
int Port = 6020 )
inlinestatic

Definition at line 56 of file TensorSpec.h.

◆ getDataType()

template<typename T >
static TensorType MLBridge::TensorSpec::getDataType ( )
staticprivate

◆ getElementByteSize()

size_t MLBridge::TensorSpec::getElementByteSize ( ) const
inline

Get the size, in bytes, of one element.

Definition at line 81 of file TensorSpec.h.

◆ getElementCount()

size_t MLBridge::TensorSpec::getElementCount ( ) const
inline

Get the number of elements in a tensor with this shape.

Definition at line 79 of file TensorSpec.h.

◆ getTotalTensorBufferSize()

size_t MLBridge::TensorSpec::getTotalTensorBufferSize ( ) const
inline

Get the total size of a memory buffer needed to store the whole tensor.

Definition at line 83 of file TensorSpec.h.

◆ isElementType()

template<typename T >
bool MLBridge::TensorSpec::isElementType ( ) const
inline

Definition at line 85 of file TensorSpec.h.

◆ name()

const std::string & MLBridge::TensorSpec::name ( ) const
inline

Definition at line 62 of file TensorSpec.h.

◆ operator!=()

Definition at line 76 of file TensorSpec.h.

◆ operator==()

bool MLBridge::TensorSpec::operator== ( const TensorSpec & Other) const
inline

Definition at line 71 of file TensorSpec.h.

◆ port()

int MLBridge::TensorSpec::port ( ) const
inline

Definition at line 63 of file TensorSpec.h.

◆ setShape()

void MLBridge::TensorSpec::setShape ( const std::vector< int64_t > & NewShape)
inline

Definition at line 66 of file TensorSpec.h.

◆ shape()

const std::vector< int64_t > & MLBridge::TensorSpec::shape ( ) const
inline

Definition at line 65 of file TensorSpec.h.

◆ toJSON()

void MLBridge::TensorSpec::toJSON ( llvm::json::OStream & OS) const

Definition at line 49 of file TensorSpec.cpp.

◆ type()

TensorType MLBridge::TensorSpec::type ( ) const
inline

Definition at line 64 of file TensorSpec.h.

Member Data Documentation

◆ ElementCount

size_t MLBridge::TensorSpec::ElementCount = 0
private

Definition at line 105 of file TensorSpec.h.

◆ ElementSize

size_t MLBridge::TensorSpec::ElementSize = 0
private

Definition at line 106 of file TensorSpec.h.

◆ Name

std::string MLBridge::TensorSpec::Name
private

Definition at line 101 of file TensorSpec.h.

◆ Port

int MLBridge::TensorSpec::Port = 0
private

Definition at line 102 of file TensorSpec.h.

◆ Shape

std::vector<int64_t> MLBridge::TensorSpec::Shape
private

Definition at line 104 of file TensorSpec.h.

◆ Type

TensorType MLBridge::TensorSpec::Type = TensorType::Invalid
private

Definition at line 103 of file TensorSpec.h.


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