diff options
author | Sebastian Messmer <messmer@fb.com> | 2019-02-27 17:54:51 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-02-27 17:57:51 -0800 |
commit | 6706e9af195137d7ec63a3cd4b9abde478fd255b (patch) | |
tree | c3bfb0e7cc0c8160e2da671a6b51d8358a84e10d /modules | |
parent | 7c5ffc41206baf391d76c7822aa5bd762db64f3a (diff) | |
download | pytorch-6706e9af195137d7ec63a3cd4b9abde478fd255b.tar.gz pytorch-6706e9af195137d7ec63a3cd4b9abde478fd255b.tar.bz2 pytorch-6706e9af195137d7ec63a3cd4b9abde478fd255b.zip |
Make C10_MOBILE consistent with how feature macros are usually used (#17481)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17481
Usually, feature macros are either defined or undefined and checked accordingly.
C10_MOBILE was a weird special case that was always defined but either defined to 1 or to 0.
This caused a lot of confusion for me when trying to disable something from mobile build and it also disabled it
from the server build (because I was using ifdef). Also, I found a place in the existing code base that made
that wrong assumption and used the macro wrongly, see https://fburl.com/y4icohts
Reviewed By: dzhulgakov
Differential Revision: D14214825
fbshipit-source-id: f3a155b6d43d334e8839e2b2e3c40ed2c773eab6
Diffstat (limited to 'modules')
-rw-r--r-- | modules/observers/perf_observer.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/observers/perf_observer.cc b/modules/observers/perf_observer.cc index ea5d22c254..2de1ce6511 100644 --- a/modules/observers/perf_observer.cc +++ b/modules/observers/perf_observer.cc @@ -1,6 +1,6 @@ #include "observers/perf_observer.h" #include "observers/observer_config.h" -#if !C10_MOBILE +#ifndef C10_MOBILE #include "caffe2/core/flags.h" #include "observers/net_observer_reporter_print.h" #endif @@ -10,7 +10,7 @@ #include "caffe2/core/init.h" #include "caffe2/core/operator.h" -#if !C10_MOBILE +#ifndef C10_MOBILE C10_DEFINE_int64( aiBench_netInitSampleRate, 0, @@ -45,7 +45,7 @@ bool registerGlobalPerfNetObserverCreator(int* /*pargc*/, char*** /*pargv*/) { return caffe2::make_unique<PerfNetObserver>(subject); }); -#if !C10_MOBILE +#if !defined(C10_MOBILE) // for aibench usage caffe2::ObserverConfig::setReporter( caffe2::make_unique<caffe2::NetObserverReporterPrint>()); |