• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / sdfglib / 20561540736

29 Dec 2025 12:13AM UTC coverage: 40.366% (+1.4%) from 38.976%
20561540736

push

github

web-flow
Merge pull request #409 from daisytuner/lib-nodes-refactor

restructures library nodes

14298 of 45900 branches covered (31.15%)

Branch coverage included in aggregate %.

259 of 388 new or added lines in 19 files covered. (66.75%)

28 existing lines in 2 files now uncovered.

12247 of 19861 relevant lines covered (61.66%)

89.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.17
/src/data_flow/library_nodes/math/tensor/elementwise_ops/leaky_relu_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/elementwise_ops/leaky_relu_node.h"
2

3
#include "sdfg/analysis/analysis.h"
4
#include "sdfg/builder/structured_sdfg_builder.h"
5

6
#include "sdfg/analysis/scope_analysis.h"
7

8
#include "sdfg/data_flow/library_nodes/math/cmath/cmath_node.h"
9

10
namespace sdfg {
11
namespace math {
12
namespace tensor {
13

14
LeakyReLUNode::LeakyReLUNode(
4✔
15
    size_t element_id,
16
    const DebugInfo& debug_info,
17
    const graph::Vertex vertex,
18
    data_flow::DataFlowGraph& parent,
19
    const std::vector<symbolic::Expression>& shape
20
)
21
    : ElementWiseUnaryNode(element_id, debug_info, vertex, parent, LibraryNodeType_LeakyReLU, shape) {
4✔
22
    this->inputs_.push_back("alpha");
4!
23
}
4✔
24

25
bool LeakyReLUNode::expand_operation(
4✔
26
    builder::StructuredSDFGBuilder& builder,
27
    analysis::AnalysisManager& analysis_manager,
28
    structured_control_flow::Sequence& body,
29
    const std::string& input_name,
30
    const std::string& output_name,
31
    const types::IType& input_type,
32
    const types::IType& output_type,
33
    const data_flow::Subset& subset
34
) {
35
    // Add code
36
    auto& code_block = builder.add_block(body);
4!
37
    auto& input_node = builder.add_access(code_block, input_name);
4!
38
    auto& output_node_max = builder.add_access(code_block, output_name);
4!
39
    auto& output_node_mul = builder.add_access(code_block, output_name);
4!
40

41
    // max(x, 0)
42
    {
43
        auto& zero_node = builder.add_constant(code_block, "0.0", types::Scalar(input_type.primitive_type()));
4!
44
        auto& tasklet =
4✔
45
            builder.add_library_node<math::cmath::CMathNode>(code_block, code_block.debug_info(), "fmax", 2);
4✔
46
        builder.add_computational_memlet(code_block, input_node, tasklet, "_in1", subset, input_type);
4!
47
        builder.add_computational_memlet(code_block, zero_node, tasklet, "_in2", subset, input_type);
4!
48
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_max, subset, output_type);
4!
49
    }
50
    // alpha * x
51
    {
52
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::fp_mul, "_out", {"_in1", "_in2"});
4!
53
        builder.add_computational_memlet(code_block, output_node_max, tasklet, "_in2", subset, output_type);
4!
54
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_mul, subset, output_type);
4!
55
    }
56

57
    return true;
4✔
58
}
×
59

60
std::unique_ptr<data_flow::DataFlowNode> LeakyReLUNode::
61
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
62
    return std::unique_ptr<
×
NEW
63
        data_flow::DataFlowNode>(new LeakyReLUNode(element_id, this->debug_info(), vertex, parent, this->shape_));
×
64
}
×
65

66
} // namespace tensor
67
} // namespace math
68
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc