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