Skip to content

Commit

Permalink
More usability notes
Browse files Browse the repository at this point in the history
  • Loading branch information
wilrich-msft committed Sep 9, 2016
1 parent 0101e91 commit 9f749f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/python/examples/CifarResNet/CifarResNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
# The minibatch source is configured using a hierarchical dictionary of key:value pairs
def create_mb_source(features_stream_name, labels_stream_name, image_height, image_width, num_channels, num_classes):
map_file_rel_path = os.path.join(*"../../../../Examples/Image/Miscellaneous/CIFAR-10/cifar-10-batches-py/train_map.txt".split("/"))
map_file = os.path.join(abs_path, map_file_rel_path)
map_file = os.path.normpath(os.path.join(abs_path, map_file_rel_path))
mean_file_rel_path = os.path.join(*"../../../../Examples/Image/Miscellaneous/CIFAR-10/cifar-10-batches-py/CIFAR-10_mean.xml".split("/"))
mean_file = os.path.join(abs_path, mean_file_rel_path)
mean_file = os.path.normpath(os.path.join(abs_path, mean_file_rel_path))

if not os.path.exists(map_file) or not os.path.exists(mean_file):
cifar_py3 = "" if sys.version_info.major < 3 else "_py3"
Expand Down
9 changes: 7 additions & 2 deletions bindings/python/examples/MNIST/SimpleMNIST.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def simple_mnist():
ce = cross_entropy_with_softmax(netout, label)
pe = classification_error(netout, label)

rel_path = r"../../../../Examples/Image/MNIST/Data/Train-28x28_cntk_text.txt"
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), rel_path)
rel_path = os.path.join(*"../../../../Examples/Image/MNIST/Data/Train-28x28_cntk_text.txt".split("/"))
path = os.path.normpath(os.path.join(abs_path, rel_path))
if not os.path.exists(path):
readme_file = os.path.normpath(os.path.join(os.path.dirname(path), "..", "README.md"))
raise RuntimeError("File '%s' does not exist. Please follow the instructions at %s to download and prepare it."%(path, readme_file))
feature_stream_name = 'features'
labels_stream_name = 'labels'

Expand Down Expand Up @@ -65,6 +68,8 @@ def simple_mnist():
if __name__=='__main__':
# Specify the target device to be used for computing
target_device = DeviceDescriptor.gpu_device(0)
# If it is crashing, probably you don't have a GPU, so try with CPU:
# target_device = DeviceDescriptor.cpu_device()
DeviceDescriptor.set_default_device(target_device)

simple_mnist()

0 comments on commit 9f749f1

Please sign in to comment.