Compute Library
 22.02
Stream Class Referencefinal

Stream frontend class to construct simple graphs in a stream fashion. More...

#include <Stream.h>

Collaboration diagram for Stream:
[legend]

Public Member Functions

 Stream (size_t id, std::string name)
 Constructor. More...
 
 Stream (const Stream &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
Streamoperator= (const Stream &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
void finalize (Target target, const GraphConfig &config)
 Finalizes the stream for an execution target. More...
 
void run ()
 Executes the stream. More...
 
void add_layer (ILayer &layer) override
 Adds a layer to the stream. More...
 
Graphgraph () override
 Returns the underlying graph. More...
 
const Graphgraph () const override
 Returns the underlying graph. More...
 
- Public Member Functions inherited from IStream
virtual ~IStream ()=default
 
NodeID tail_node ()
 Returns the tail node of the Stream. More...
 
StreamHintshints ()
 Returns the stream hints that are currently used. More...
 
void forward_tail (NodeID nid)
 Forwards tail of stream to a given nid. More...
 

Detailed Description

Stream frontend class to construct simple graphs in a stream fashion.

Definition at line 45 of file Stream.h.

Constructor & Destructor Documentation

◆ Stream() [1/2]

Stream ( size_t  id,
std::string  name 
)

Constructor.

Parameters
[in]idStream id
[in]nameStream name

Definition at line 35 of file Stream.cpp.

36  : _ctx(), _manager(), _g(id, std::move(name))
37 {
38 }
const char * name

◆ Stream() [2/2]

Stream ( const Stream )
delete

Prevent instances of this class from being copied (As this class contains pointers)

Member Function Documentation

◆ add_layer()

void add_layer ( ILayer layer)
overridevirtual

Adds a layer to the stream.

Parameters
[in]layerLayer to add

Implements IStream.

Definition at line 52 of file Stream.cpp.

References ILayer::create_layer().

53 {
54  auto nid = layer.create_layer(*this);
55  _tail_node = nid;
56 }

◆ finalize()

void finalize ( Target  target,
const GraphConfig config 
)

Finalizes the stream for an execution target.

Parameters
[in]targetExecution target
[in]config(Optional) Graph configuration to use

Definition at line 40 of file Stream.cpp.

References arm_compute::graph::create_default_pass_manager(), GraphManager::finalize_graph(), and GraphContext::set_config().

41 {
42  PassManager pm = create_default_pass_manager(target, config);
43  _ctx.set_config(config);
44  _manager.finalize_graph(_g, _ctx, pm, target);
45 }
void finalize_graph(Graph &graph, GraphContext &ctx, PassManager &pm, Target target)
Finalizes a given graph.
void set_config(const GraphConfig &config)
Sets graph configuration.
PassManager create_default_pass_manager(Target target, const GraphConfig &cfg)
Creates a default PassManager.
Definition: Utils.cpp:73

◆ graph() [1/2]

Graph & graph ( )
overridevirtual

Returns the underlying graph.

Returns
Underlying graph

Implements IStream.

Definition at line 63 of file Stream.cpp.

64 {
65  return _g;
66 }

◆ graph() [2/2]

const Graph & graph ( ) const
overridevirtual

Returns the underlying graph.

Returns
Underlying graph

Implements IStream.

Definition at line 58 of file Stream.cpp.

59 {
60  return _g;
61 }

◆ operator=()

Stream& operator= ( const Stream )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ run()

void run ( )

Executes the stream.

Definition at line 47 of file Stream.cpp.

References GraphManager::execute_graph().

48 {
49  _manager.execute_graph(_g);
50 }
void execute_graph(Graph &graph)
Executes a graph.

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