|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- /* Tencent is pleased to support the open source community by making ncnn available.
- *
- * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
- *
- * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * https://opensource.org/licenses/BSD-3-Clause
- *
- * Unless required by applicable law or agreed to in writing, software distributed
- * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-
- #ifndef PYBIND11_NCNN_LAYER_H
- #define PYBIND11_NCNN_LAYER_H
-
- #include <layer.h>
- #include "pybind11_bind.h"
-
- class PyLayer : public ncnn::Layer
- {
- public:
- virtual int load_param(const ncnn::ParamDict& pd)
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- load_param,
- pd);
- }
-
- virtual int load_model(const ncnn::ModelBin& mb)
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- load_model,
- mb);
- }
-
- virtual int create_pipeline(const ncnn::Option& opt)
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- create_pipeline,
- opt);
- }
-
- virtual int destroy_pipeline(const ncnn::Option& opt)
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- destroy_pipeline,
- opt);
- }
-
- public:
- virtual int forward(const std::vector<ncnn::Mat>& bottom_blobs, std::vector<ncnn::Mat>& top_blobs, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward,
- bottom_blobs,
- top_blobs,
- opt);
- }
- virtual int forward(const ncnn::Mat& bottom_blob, ncnn::Mat& top_blob, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward,
- bottom_blob,
- top_blob,
- opt);
- }
-
- virtual int forward_inplace(std::vector<ncnn::Mat>& bottom_top_blobs, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward_inplace,
- bottom_top_blobs,
- opt);
- }
- virtual int forward_inplace(ncnn::Mat& bottom_top_blob, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward_inplace,
- bottom_top_blob,
- opt);
- }
-
- #if NCNN_VULKAN
- public:
- virtual int upload_model(ncnn::VkTransfer& cmd, const ncnn::Option& opt)
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- upload_model,
- cmd,
- opt);
- }
-
- public:
- virtual int forward(const std::vector<ncnn::VkMat>& bottom_blobs, std::vector<ncnn::VkMat>& top_blobs, ncnn::VkCompute& cmd, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward,
- bottom_blobs,
- top_blobs,
- cmd,
- opt);
- }
- virtual int forward(const ncnn::VkMat& bottom_blob, ncnn::VkMat& top_blob, ncnn::VkCompute& cmd, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward,
- bottom_blob,
- top_blob,
- cmd,
- opt);
- }
-
- virtual int forward_inplace(std::vector<ncnn::VkMat>& bottom_top_blobs, ncnn::VkCompute& cmd, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward_inplace,
- bottom_top_blobs,
- cmd,
- opt);
- }
- virtual int forward_inplace(ncnn::VkMat& bottom_top_blob, ncnn::VkCompute& cmd, const ncnn::Option& opt) const
- {
- PYBIND11_OVERRIDE_REFERENCE(
- int,
- ncnn::Layer,
- forward_inplace,
- bottom_top_blob,
- cmd,
- opt);
- }
- #endif // NCNN_VULKAN
- };
-
- #endif
|