docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
leaky_relu_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
30class LeakyReLUNode : public TensorNode {
31private:
32 std::vector<symbolic::Expression> shape_;
33
34public:
36 size_t element_id,
37 const DebugInfo& debug_info,
40 const std::vector<symbolic::Expression>& shape,
42 );
43
44 static constexpr int Y_INPUT_IDX = 0;
45 static constexpr int X_INPUT_IDX = 1;
46 static constexpr int ALPHA_INPUT_IDX = 2;
47
48 const std::vector<symbolic::Expression>& shape() const;
49
50 void validate(const Function& function) const override;
51
52 bool supports_integer_types() const override;
53
56
58
59 std::string toStr() const override;
60
61 symbolic::SymbolSet symbols() const override;
62
63 std::unique_ptr<data_flow::DataFlowNode>
64 clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const override;
65
66 void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override;
67
68 void replace(const symbolic::ExpressionMapping& replacements) override;
69};
70
72public:
73 nlohmann::json serialize(const data_flow::LibraryNode& library_node) override;
74
77 ) override;
78};
79
80} // namespace tensor
81} // namespace math
82} // 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
Definition leaky_relu_node.h:71
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.
const std::vector< symbolic::Expression > & shape() const
static constexpr int ALPHA_INPUT_IDX
Definition leaky_relu_node.h:46
static constexpr int Y_INPUT_IDX
Definition leaky_relu_node.h:44
void replace(const symbolic::ExpressionMapping &replacements) override
static constexpr int X_INPUT_IDX
Definition leaky_relu_node.h:45
std::string toStr() const override
Convert node to string representation.
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.
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
Describes what a pointer is used for.
bool supports_integer_types() const override
Check if this operation supports integer types.
LeakyReLUNode(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)
void validate(const Function &function) const override
Validate the code node's configuration.
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.
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_LeakyReLU("ml::LeakyReLU")
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.