path_wd = os.path.abspath(
os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'..',
'temp',
str(time.time())
)
)
os.makedirs(path_wd)
# GET DATASET #
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# Normalize input so we can train ANN with it.
`enter code here`# Will be converted back to integers for SNN layer.
x_train = x_train / 255
x_test = x_test / 255
axis = 1 if keras.backend.image_data_format() == 'channels_first' else -1
x_train = np.expand_dims(x_train, axis)
x_test = np.expand_dims(x_test, axis)..
Asked
Active
Viewed 57 times
0
-
Are you running this code in a Python shell? – bereal Aug 20 '21 at 07:59
1 Answers
0
Sounds like you're running the code in interactive mode (typing in a command line interface).
This is meant to work when the code is in a .py file. (See https://stackoverflow.com/a/9271479/4653485.)
I suppose you copy-pasted this from a tutorial. Replace the whole thing with the path you want to use as working directory.
path_wd = "/home/ramapati/path_to_temp_dir/"
os.makedirs(path_wd)
...

Jérôme
- 13,328
- 7
- 56
- 106