| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include "pass_level1.h" |
| |
|
| | #include "../utils.h" |
| |
|
| | namespace pnnx { |
| |
|
| | class LeakyReLU : public FuseModulePass |
| | { |
| | public: |
| | const char* match_type_str() const |
| | { |
| | return "__torch__.torch.nn.modules.activation.LeakyReLU"; |
| | } |
| |
|
| | const char* type_str() const |
| | { |
| | return "nn.LeakyReLU"; |
| | } |
| |
|
| | void write(Operator* op, const std::shared_ptr<torch::jit::Graph>& graph) const |
| | { |
| | const torch::jit::Node* leaky_relu = find_node_by_kind(graph, "aten::leaky_relu"); |
| | const torch::jit::Node* leaky_relu_ = find_node_by_kind(graph, "aten::leaky_relu_"); |
| |
|
| | if (leaky_relu_) |
| | { |
| | leaky_relu = leaky_relu_; |
| | } |
| |
|
| | op->params["negative_slope"] = leaky_relu->namedInput("negative_slope"); |
| | } |
| | }; |
| |
|
| | REGISTER_GLOBAL_PNNX_FUSE_MODULE_PASS(LeakyReLU) |
| |
|
| | } |
| |
|