-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Making Features as a singleton for improved caching #15835
Conversation
@ChaiBapchya @apeforest please review |
@mxnet-label-bot add[pr-awaiting-review] |
@larroy please review |
914667d
to
cc39360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -73,6 +73,12 @@ class Features(collections.OrderedDict): | |||
""" | |||
OrderedDict of name to Feature | |||
""" | |||
instance = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, simple and nice.
6ace6e8
to
ecab594
Compare
ecab594
to
a0f50bc
Compare
@mxnet-label-bot add [pr-awaiting-merge] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
good to see caching implemented!
Brownie points for those lint fixes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! LGTM. : )
Description
Caches Features by making it singleton.
Used Approach mentioned here: https://medium.com/@mrfksiv/python-design-patterns-2-the-singleton-f995c3198c8
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Testing
ubuntu@ip-172-31-82-110 ~/incubator-mxnet (singleton_feature) $ MXNET_TEST_COUNT=1 nosetests --logging-level=DEBUG --verbose -s tests/python/unittest/test_runtime.py
1
/home/ubuntu/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
.from ._conv import register_converters as _register_converters
test_runtime.test_features ... 2
[✖ CUDA, ✖ CUDNN, ✖ NCCL, ✖ CUDA_RTC, ✖ TENSORRT, ✔ CPU_SSE, ✔ CPU_SSE2, ✔ CPU_SSE3, ✔ CPU_SSE4_1, ✔ CPU_SSE4_2, ✖ CPU_SSE4A, ✔ CPU_AVX, ✖ CPU_AVX2, ✖ OPENMP, ✖ SSE, ✔ F16C, ✖ JEMALLOC, ✔ BLAS_OPEN, ✖ BLAS_ATLAS, ✖ BLAS_MKL, ✖ BLAS_APPLE, ✖ LAPACK, ✖ MKLDNN, ✖ OPENCV, ✖ CAFFE, ✖ PROFILER, ✖ DIST_KVSTORE, ✖ CXX14, ✔ INT64_TENSOR_SIZE, ✖ SIGNAL_HANDLER, ✔ DEBUG, ✖ TVM_OP]
ok
test_runtime.test_is_singleton ... 2
2
ok
test_runtime.test_is_enabled ... 2
ok
test_runtime.test_is_enabled_not_existing ... 2
ok
Ran 4 tests in 0.001s