Skip to content

Commit a2caffa

Browse files
committed
Use os util to fetch mnist data location from example location
1 parent 956a227 commit a2caffa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/machine_learning/mnist_common.py

Lines changed: 5 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy