Compute Library
ConstantLayer Class Referencefinal

Constant Layer. More...

#include <Layers.h>

Collaboration diagram for ConstantLayer:

Public Member Functions

 ConstantLayer (TensorDescriptor desc, ITensorAccessorUPtr accessor)
 Construct a constant 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

Constant Layer.

Definition at line 70 of file Layers.h.

Constructor & Destructor Documentation

◆ ConstantLayer()

ConstantLayer ( TensorDescriptor  desc,
ITensorAccessorUPtr  accessor 

Construct a constant layer.

[in]descDescription of input tensor.
[in]accessorAccessor to get input tensor data from.

Definition at line 78 of file Layers.h.

79  : _desc(desc), _accessor(std::move(accessor))
80  {
81  }

Member Function Documentation

◆ create_layer()

NodeID create_layer ( IStream s)

Create layer and add to the given stream.

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

Implements ILayer.

Definition at line 83 of file Layers.h.

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

84  {
85  NodeParams common_params = { name(), s.hints().target_hint };
86  return GraphBuilder::add_const_node(s.graph(), common_params, _desc, std::move(_accessor));
87  }
const std::string & name() const
Layer name accessor.
Definition: ILayer.h:64
static NodeID add_const_node(Graph &g, NodeParams params, const TensorDescriptor &desc, ITensorAccessorUPtr accessor=nullptr)
Adds a Const node to the graph.

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