Blame view

3rdparty/opencv-4.5.4/modules/dnn/src/onnx/onnx_graph_simplifier.hpp 1.11 KB
f4334277   Hu Chunming   提交3rdparty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  // This file is part of OpenCV project.
  // It is subject to the license terms in the LICENSE file found in the top-level directory
  // of this distribution and at http://opencv.org/license.html.
  
  // Copyright (C) 2020, Intel Corporation, all rights reserved.
  // Third party copyrights are property of their respective owners.
  
  #ifndef __OPENCV_DNN_ONNX_SIMPLIFIER_HPP__
  #define __OPENCV_DNN_ONNX_SIMPLIFIER_HPP__
  
  #include "../precomp.hpp"
  
  #if defined(__GNUC__) && __GNUC__ >= 5
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wsuggest-override"
  #endif
  #include "opencv-onnx.pb.h"
  #if defined(__GNUC__) && __GNUC__ >= 5
  #pragma GCC diagnostic pop
  #endif
  
  namespace cv { namespace dnn {
  CV__DNN_INLINE_NS_BEGIN
  
  void simplifySubgraphs(opencv_onnx::GraphProto& net);
  
  template<typename T1, typename T2>
  void convertInt64ToInt32(const T1& src, T2& dst, int size)
  {
      for (int i = 0; i < size; i++)
      {
          dst[i] = saturate_cast<int32_t>(src[i]);
      }
  }
  
  Mat getMatFromTensor(opencv_onnx::TensorProto& tensor_proto);
  
  CV__DNN_INLINE_NS_END
  }}  // namespace dnn, namespace cv
  
  #endif  // __OPENCV_DNN_ONNX_SIMPLIFIER_HPP__