1 #ifndef USE_XNNPACK
2
3 #include <ATen/native/xnnpack/Common.h>
4 #include <ATen/native/xnnpack/Engine.h>
5 #include <ATen/core/Tensor.h>
6
7 //
8 // This file is here so as to provide an implementation even in cases where
9 // PyTorch is compiled without XNNPACK support. Under those scenarios, either
10 // all XNNPACK usage must be gated with #ifdefs at call-sites which would make
11 // for cluttered logic, or alternatively, all use can be routed to a central
12 // place, namely here, where available() calls return false preventing the
13 // XNNPACK related codepaths to be taken, and use of the actual operators
14 // trigger an error.
15 //
16
17 namespace at::native::xnnpack {
18 namespace internal {
19 namespace {
20
21 constexpr const char * const kError =
22 "Not Implemented! Reason: PyTorch not built with XNNPACK support.";
23
24 } // namespace
25 } // namespace internal
26
available()27 bool available() {
28 return false;
29 }
30
use_convolution2d(const Tensor &,const Tensor &,const at::OptionalIntArrayRef,const IntArrayRef,const IntArrayRef,const IntArrayRef,const int64_t,bool)31 bool use_convolution2d(
32 const Tensor&,
33 const Tensor&,
34 const at::OptionalIntArrayRef,
35 const IntArrayRef,
36 const IntArrayRef,
37 const IntArrayRef,
38 const int64_t,
39 bool) {
40 return false;
41 }
42
convolution2d(const Tensor &,const Tensor &,const Tensor &,const IntArrayRef,const IntArrayRef,const IntArrayRef,const int64_t)43 Tensor convolution2d(
44 const Tensor&,
45 const Tensor&,
46 const Tensor&,
47 const IntArrayRef,
48 const IntArrayRef,
49 const IntArrayRef,
50 const int64_t) {
51 TORCH_CHECK(false, internal::kError);
52 }
53
use_linear(const Tensor &,const Tensor &,const Tensor &)54 bool use_linear(
55 const Tensor&,
56 const Tensor&,
57 const Tensor&) {
58 return false;
59 }
60
linear(const Tensor &,const Tensor &,const Tensor &)61 Tensor linear(
62 const Tensor&,
63 const Tensor&,
64 const Tensor&) {
65 TORCH_CHECK(false, internal::kError);
66 }
67
use_max_pool2d(const Tensor &,const IntArrayRef,const IntArrayRef,IntArrayRef,const IntArrayRef,const bool,const float,const float)68 bool use_max_pool2d(
69 const Tensor&,
70 const IntArrayRef,
71 const IntArrayRef,
72 IntArrayRef,
73 const IntArrayRef,
74 const bool,
75 const float,
76 const float) {
77 return false;
78 }
79
max_pool2d(const Tensor &,const IntArrayRef,const IntArrayRef,IntArrayRef,const IntArrayRef,const bool,const float,const float)80 Tensor max_pool2d(
81 const Tensor&,
82 const IntArrayRef,
83 const IntArrayRef,
84 IntArrayRef,
85 const IntArrayRef,
86 const bool,
87 const float,
88 const float) {
89 TORCH_CHECK(false, internal::kError);
90 }
91
92 } // namespace at::native::xnnpack
93
94 #endif /* USE_XNNPACK */
95