Skip to content

Commit ace05e9

Browse files
committed
Use os util to fetch mnist data location from example location
1 parent 76ee7e7 commit ace05e9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/machine_learning/mnist_common.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# http://arrayfire.com/licenses/BSD-3-Clause
1010
########################################################
1111

12+
import os
1213
import sys
1314
sys.path.insert(0, '../common')
1415
from idxio import read_idx
@@ -41,8 +42,10 @@ def classify(arr, k, expand_labels):
4142

4243

4344
def setup_mnist(frac, expand_labels):
44-
idims, idata = read_idx('../../assets/examples/data/mnist/images-subset')
45-
ldims, ldata = read_idx('../../assets/examples/data/mnist/labels-subset')
45+
root_path = os.path.dirname(os.path.abspath(__file__))
46+
file_path = root_path + '/../../assets/examples/data/mnist/'
47+
idims, idata = read_idx(file_path + 'images-subset')
48+
ldims, ldata = read_idx(file_path + 'labels-subset')
4649

4750
idims.reverse()
4851
numdims = len(idims)

0 commit comments

Comments
 (0)