docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
mean_node.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace sdfg {
6namespace math {
7namespace tensor {
8
10
11class MeanNode : public ReduceNode {
12public:
14 size_t element_id,
15 const DebugInfo& debug_info,
18 const std::vector<symbolic::Expression>& shape,
19 const std::vector<int64_t>& axes,
20 bool keepdims
21 );
22
27 const types::Tensor& input_type,
28 const types::Tensor& output_type,
29 const data_flow::Subset& input_subset,
30 const data_flow::Subset& output_subset
31 ) override;
32
33 std::string identity(types::PrimitiveType primitive_type) const override;
34
35 bool supports_integer_types() const override {
36 return false;
37 }
38
39 std::unique_ptr<data_flow::DataFlowNode>
40 clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const override;
41
42protected:
46 const data_flow::Memlet* iedge_input,
47 const data_flow::Memlet* iedge_result,
48 const std::vector<symbolic::Expression>& output_shape,
49 const std::vector<int64_t>& sorted_axes
50 ) override;
51};
52
54
55} // namespace tensor
56} // namespace math
57} // namespace sdfg
Definition element.h:30
size_t element_id() const
const DebugInfo & debug_info() const
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.
Edge in the dataflow graph representing data movement.
Definition memlet.h:131
passes::LibNodeExpander::ExpandOutcome expand_inner(passes::LibNodeExpander::AccessNodeExpand &expansion, structured_control_flow::Block &block, const data_flow::Memlet *iedge_input, const data_flow::Memlet *iedge_result, const std::vector< symbolic::Expression > &output_shape, const std::vector< int64_t > &sorted_axes) override
std::string identity(types::PrimitiveType primitive_type) const override
Get the identity value for this reduction.
bool supports_integer_types() const override
Check if this operation supports integer types.
Definition mean_node.h:35
MeanNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const std::vector< symbolic::Expression > &shape, const std::vector< int64_t > &axes, bool keepdims)
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.
bool expand_reduction(passes::LibNodeExpander::AccessNodeExpand &expansion, builder::StructuredSDFGBuilder &builder, structured_control_flow::Sequence &body, const types::Tensor &input_type, const types::Tensor &output_type, const data_flow::Subset &input_subset, const data_flow::Subset &output_subset) override
Generate the actual reduction code.
Definition reduce_node.h:230
ReduceNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::LibraryNodeCode &code, const std::vector< symbolic::Expression > &shape, const std::vector< int64_t > &axes, bool keepdims)
Construct a reduction node.
const std::vector< symbolic::Expression > & shape() const
Get the input tensor shape.
Definition reduce_node.h:123
const std::vector< int64_t > & axes() const
Get the reduction axes.
Definition reduce_node.h:131
bool keepdims() const
Check if reduced dimensions are kept.
Definition reduce_node.h:139
types::PrimitiveType primitive_type(const data_flow::DataFlowGraph &graph) const
Get the primitive type of this tensor operation.
Definition lib_node_expander.h:45
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
A sequential container of control flow nodes.
Definition sequence.h:52
Definition tensor.h:13
Definition function_builder.h:10
symbolic::MultiExpression Subset
Type alias for a subset specification (array of symbolic expressions).
Definition memlet.h:103
StringEnum LibraryNodeCode
Definition library_node.h:65
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition arange_node.h:8
data_flow::LibraryNodeCode LibraryNodeType_Mean("ml::Mean")
ReduceNodeSerializer< MeanNode > MeanNodeSerializer
Definition mean_node.h:53
Definition batched_gemm_node.h:12
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
Definition analysis.h:7
Tensor reduction operation nodes.
Definition lib_node_expander.h:12