1 // Tencent is pleased to support the open source community by making ncnn 2 // available. 3 // 4 // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 5 // 6 // Licensed under the BSD 3-Clause License (the "License"); you may not use this 7 // file except in compliance with the License. You may obtain a copy of the 8 // License at 9 // 10 // https://opensource.org/licenses/BSD-3-Clause 11 // 12 // Unless required by applicable law or agreed to in writing, software 13 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 // License for the specific language governing permissions and limitations under 16 // the License. 17 18 #ifndef LAYER_INNERPRODUCT_X86_H 19 #define LAYER_INNERPRODUCT_X86_H 20 21 #include "innerproduct.h" 22 23 namespace ncnn { 24 25 class InnerProduct_x86 : virtual public InnerProduct 26 { 27 public: 28 InnerProduct_x86(); 29 30 virtual int create_pipeline(const Option& opt); 31 virtual int destroy_pipeline(const Option& opt); 32 33 virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const; 34 35 protected: 36 int forward_fp16(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const; 37 #if NCNN_INT8 38 int create_pipeline_int8_x86(const Option& opt); 39 int forward_int8_x86(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const; 40 #endif 41 42 public: 43 Layer* flatten; 44 Layer* activation; 45 46 Mat weight_data_packed; 47 48 // fp16 weight data 49 Mat weight_data_fp16; 50 51 #if NCNN_INT8 52 // int8 53 Mat weight_data_int8; 54 Mat scales_in; 55 #endif 56 }; 57 58 } // namespace ncnn 59 60 #endif // LAYER_INNERPRODUCT_X86_H 61