Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /