docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
elu_node.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <memory>
8#include <nlohmann/json_fwd.hpp>
9#include <string>
10#include <vector>
11
14#include "sdfg/function.h"
18
19namespace sdfg {
20namespace math {
21namespace tensor {
22
24
31class EluNode : public TensorNode {
32private:
33 std::vector<symbolic::Expression> shape_;
34
35public:
37 size_t element_id,
38 const DebugInfo& debug_info,
41 const std::vector<symbolic::Expression>& shape,
43 );
44
45 static constexpr int Y_INPUT_IDX = 0;
46 static constexpr int X_INPUT_IDX = 1;
47 static constexpr int ALPHA_INPUT_IDX = 2;
48 static constexpr int SCALE_INPUT_IDX = 3;
49 static constexpr int INPUT_SCALE_INPUT_IDX = 4;
50
51 const std::vector<symbolic::Expression>& shape() const;
52
53 void validate(const Function& function) const override;
54
55 bool supports_integer_types() const override;
56
59
61
62 std::string toStr() const override;
63
64 symbolic::SymbolSet symbols() const override;
65
66 std::unique_ptr<data_flow::DataFlowNode>
67 clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const override;
68
69 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
70
71 void replace(const symbolic::ExpressionMapping& replacements) override;
72};
73
75public:
76 nlohmann::json serialize(const data_flow::LibraryNode& library_node) override;
77
80 ) override;
81};
82
83} // namespace tensor
84} // namespace math
85} // namespace sdfg
Definition element.h:30
size_t element_id() const
const DebugInfo & debug_info() const
Definition function.h:43
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
data_flow::LibraryNode & deserialize(const nlohmann::json &j, builder::StructuredSDFGBuilder &builder, structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
nlohmann::json serialize(const data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
static constexpr int ALPHA_INPUT_IDX
Definition elu_node.h:47
bool supports_integer_types() const override
Check if this operation supports integer types.
static constexpr int SCALE_INPUT_IDX
Definition elu_node.h:48
std::unique_ptr< data_flow::DataFlowNode > clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph &parent) const override
Clone this node for graph transformations.
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
void validate(const Function &function) const override
Validate the code node's configuration.
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
passes::LibNodeExpander::ExpandOutcome expand(passes::LibNodeExpander::ExpandContext &context, structured_control_flow::Block &block) override
Expand this node into its internal operations.
static constexpr int X_INPUT_IDX
Definition elu_node.h:46
void replace(const symbolic::ExpressionMapping &replacements) override
std::string toStr() const override
Convert node to string representation.
EluNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const std::vector< symbolic::Expression > &shape, const data_flow::ImplementationType &impl_type=data_flow::ImplementationType_NONE)
static constexpr int INPUT_SCALE_INPUT_IDX
Definition elu_node.h:49
const std::vector< symbolic::Expression > & shape() const
static constexpr int Y_INPUT_IDX
Definition elu_node.h:45
TensorNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::LibraryNodeCode &code, const std::vector< std::string > &outputs, const std::vector< std::string > &inputs, const data_flow::ImplementationType &impl_type)
Construct a tensor node.
Definition lib_node_expander.h:122
Base class for library node serialization.
Definition json_serializer.h:195
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
std::set< Symbol, SymEngine::RCPBasicKeyLess > SymbolSet
Ordered set of symbols.
Definition symbolic.h:95
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition function_builder.h:10
StringEnum ImplementationType
Implementation type identifier for library nodes.
Definition library_node.h:75
StringEnum LibraryNodeCode
Definition library_node.h:65
ImplementationType ImplementationType_NONE
Default implementation type indicating no specific implementation.
Definition library_node.h:84
std::unique_ptr< PointerAccessMeta, PtrAccessDeleter > PointerAccessType
Definition pointer_metadata.h:32
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition arange_node.h:8
data_flow::LibraryNodeCode LibraryNodeType_Elu("ml::Elu")
Definition batched_gemm_node.h:12
Definition analysis.h:7
Definition lib_node_expander.h:12
Symbolic system for integer-based symbol analysis.
Abstract base class for tensor library nodes.