Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Public Types | Public Member Functions | List of all members
dragon::Workspace Class Reference

#include <workspace.h>

Public Types

typedef Map< string, Map< string, int64_t > > DummyNameMap
 
typedef Map< string, unique_ptr< Tensor > > TensorMap
 
typedef Map< string, string > TensorAliasMap
 
typedef Map< string, TensorFillerProto > TensorFillerMap
 
typedef Map< string, unique_ptr< OperatorBase > > OperatorMap
 
typedef Map< string, unique_ptr< GraphBase > > GraphMap
 

Public Member Functions

 Workspace (const string &name)
 Constructor. More...
 
const string & name ()
 Return the name of this workspace. More...
 
vector< string > tensors () const
 Return the name of stored tensors. More...
 
vector< string > graphs () const
 Return the name of stored graphs. More...
 
void Initialize ()
 Create some internal tensors. More...
 
void Clear ()
 Destory all the tensors. More...
 
void MergeFrom (Workspace *ws)
 Merge from a external workspace. More...
 
string GetTensorName (const string &name) const
 Query the real name of specified tensor. More...
 
TensorTryGetTensor (const string &name, bool use_remote=true) const
 Try to serach the specified tensor in this workspace. More...
 
bool HasTensor (const string &name, bool use_remote=true) const
 Whether the specified tensor is in this workspace. More...
 
TensorCreateTensor (const string &name)
 Create the specified tensor. More...
 
TensorGetTensor (const string &name, bool use_remote=true) const
 Return the specified tensor. More...
 
void ResetTensor (const string &name)
 Reset the specified tensor. More...
 
bool HasFiller (const string &name, bool use_remote=true) const
 
void CreateFiller (const TensorFillerProto &filler)
 Create the specified filler. More...
 
const TensorFillerProto * GetFiller (const string &name) const
 Return the specified filler. More...
 
template<class Context >
vector< void * > data (const vector< size_t > &segments)
 Create temporal data segments. More...
 
template<typename T , class Context >
vector< T * > data (const vector< int64_t > &segments)
 Create temporal cache segments with the specified type. More...
 
OperatorBaseCreateOperator (const OperatorDef &def)
 Create a operator in this workspace. More...
 
void RunOperator (const OperatorDef &def)
 Run the specified persistent operator. More...
 
void RunOperatorOnce (const OperatorDef &def)
 Try to run the operator in a adaptive mode. More...
 
GraphBaseCreateGraph (const GraphDef &def)
 Create a Graph in this workspace. More...
 
void RunGraph (const string &graph_name, const string &include, const string &exclude, int stream_id=0)
 Run the specifed graph by name and rules. More...
 
bool SetTensorAlias (const string &name, const string &alias)
 
string GetDummyName (const string &base_name, const string &suffix, const string &domain="", const bool zero_based=true)
 

Member Typedef Documentation

◆ DummyNameMap

typedef Map<string, Map<string, int64_t> > dragon::Workspace::DummyNameMap

◆ GraphMap

typedef Map<string, unique_ptr<GraphBase> > dragon::Workspace::GraphMap

◆ OperatorMap

typedef Map<string, unique_ptr<OperatorBase> > dragon::Workspace::OperatorMap

◆ TensorAliasMap

typedef Map<string, string> dragon::Workspace::TensorAliasMap

◆ TensorFillerMap

typedef Map<string, TensorFillerProto> dragon::Workspace::TensorFillerMap

◆ TensorMap

typedef Map<string, unique_ptr<Tensor> > dragon::Workspace::TensorMap

Constructor & Destructor Documentation

◆ Workspace()

dragon::Workspace::Workspace ( const string &  name)
inline

Constructor.

Member Function Documentation

◆ Clear()

void dragon::Workspace::Clear ( )

Destory all the tensors.

◆ CreateFiller()

void dragon::Workspace::CreateFiller ( const TensorFillerProto &  filler)

Create the specified filler.

◆ CreateGraph()

GraphBase * dragon::Workspace::CreateGraph ( const GraphDef &  def)

Create a Graph in this workspace.

◆ CreateOperator()

OperatorBase * dragon::Workspace::CreateOperator ( const OperatorDef &  def)

Create a operator in this workspace.

◆ CreateTensor()

Tensor * dragon::Workspace::CreateTensor ( const string &  name)

Create the specified tensor.

◆ data() [1/2]

template<class Context >
vector<void*> dragon::Workspace::data ( const vector< size_t > &  segments)
inline

Create temporal data segments.

◆ data() [2/2]

template<typename T , class Context >
vector<T*> dragon::Workspace::data ( const vector< int64_t > &  segments)
inline

Create temporal cache segments with the specified type.

◆ GetDummyName()

string dragon::Workspace::GetDummyName ( const string &  base_name,
const string &  suffix,
const string &  domain = "",
const bool  zero_based = true 
)

◆ GetFiller()

const TensorFillerProto * dragon::Workspace::GetFiller ( const string &  name) const

Return the specified filler.

◆ GetTensor()

Tensor * dragon::Workspace::GetTensor ( const string &  name,
bool  use_remote = true 
) const

Return the specified tensor.

◆ GetTensorName()

string dragon::Workspace::GetTensorName ( const string &  name) const

Query the real name of specified tensor.

◆ graphs()

vector< string > dragon::Workspace::graphs ( ) const

Return the name of stored graphs.

◆ HasFiller()

bool dragon::Workspace::HasFiller ( const string &  name,
bool  use_remote = true 
) const

◆ HasTensor()

bool dragon::Workspace::HasTensor ( const string &  name,
bool  use_remote = true 
) const
inline

Whether the specified tensor is in this workspace.

◆ Initialize()

void dragon::Workspace::Initialize ( )

Create some internal tensors.

◆ MergeFrom()

void dragon::Workspace::MergeFrom ( Workspace ws)

Merge from a external workspace.

◆ name()

const string& dragon::Workspace::name ( )
inline

Return the name of this workspace.

◆ ResetTensor()

void dragon::Workspace::ResetTensor ( const string &  name)

Reset the specified tensor.

◆ RunGraph()

void dragon::Workspace::RunGraph ( const string &  graph_name,
const string &  include,
const string &  exclude,
int  stream_id = 0 
)

Run the specifed graph by name and rules.

◆ RunOperator()

void dragon::Workspace::RunOperator ( const OperatorDef &  def)

Run the specified persistent operator.

◆ RunOperatorOnce()

void dragon::Workspace::RunOperatorOnce ( const OperatorDef &  def)

Try to run the operator in a adaptive mode.

◆ SetTensorAlias()

bool dragon::Workspace::SetTensorAlias ( const string &  name,
const string &  alias 
)

◆ tensors()

vector< string > dragon::Workspace::tensors ( ) const

Return the name of stored tensors.

◆ TryGetTensor()

Tensor * dragon::Workspace::TryGetTensor ( const string &  name,
bool  use_remote = true 
) const

Try to serach the specified tensor in this workspace.


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