Compute Library
 21.11
EltwiseLayer Class Referencefinal

#include <Layers.h>

Collaboration diagram for EltwiseLayer:
[legend]

Public Member Functions

 EltwiseLayer (SubStream &&sub_stream0, SubStream &&sub_stream1, EltwiseOperation op)
 Construct an element-wise operation layer. More...
 
NodeID create_layer (IStream &s) override
 Create layer and add to the given stream. More...
 
- Public Member Functions inherited from ILayer
virtual ~ILayer ()=default
 Default destructor. More...
 
ILayerset_name (std::string name)
 Sets the name of the layer. More...
 
const std::string & name () const
 Layer name accessor. More...
 

Detailed Description

Definition at line 664 of file Layers.h.

Constructor & Destructor Documentation

◆ EltwiseLayer()

EltwiseLayer ( SubStream &&  sub_stream0,
SubStream &&  sub_stream1,
EltwiseOperation  op 
)
inline

Construct an element-wise operation layer.

Parameters
[in]sub_stream0First graph sub-stream
[in]sub_stream1First graph sub-stream
[in]opElement-wise operation to perform

Definition at line 673 of file Layers.h.

674  : _ss0(std::move(sub_stream0)), _ss1(std::move(sub_stream1)), _op(op)
675  {
676  }

Member Function Documentation

◆ create_layer()

NodeID create_layer ( IStream s)
inlineoverridevirtual

Create layer and add to the given stream.

Parameters
[in]sStream to add layer to.
Returns
ID of the created node.

Implements ILayer.

Definition at line 678 of file Layers.h.

References GraphBuilder::add_elementwise_node(), IStream::graph(), IStream::hints(), ILayer::name(), and StreamHints::target_hint.

679  {
680  NodeParams common_params = { name(), s.hints().target_hint };
681  NodeIdxPair input0 = { _ss0.tail_node(), 0 };
682  NodeIdxPair input1 = { _ss1.tail_node(), 0 };
683 
684  return GraphBuilder::add_elementwise_node(s.graph(), common_params, input0, input1, _op);
685  }
static NodeID add_elementwise_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, EltwiseOperation operation)
Adds an element-wise layer node to the graph.
NodeID tail_node()
Returns the tail node of the Stream.
Definition: IStream.h:65
const std::string & name() const
Layer name accessor.
Definition: ILayer.h:64

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