bindings/python/examples: use relative paths wrt. __file__, not current directory
This commit is contained in:
Родитель
d424bba2c5
Коммит
8dcfdd1256
|
@ -129,6 +129,7 @@ def cifar_resnet(data_path, run_test, num_epochs, communicator=None, save_model_
|
|||
|
||||
if __name__ == '__main__':
|
||||
data_path = os.path.abspath(os.path.normpath(os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
*"../../../../Examples/Image/DataSets/CIFAR-10/".split("/"))))
|
||||
|
||||
os.chdir(data_path)
|
||||
|
@ -161,4 +162,4 @@ if __name__ == '__main__':
|
|||
|
||||
print("Error: %f" % error)
|
||||
|
||||
distributed.communicator.finalize()
|
||||
distributed.communicator.finalize()
|
||||
|
|
|
@ -25,9 +25,11 @@ def test_cifar_resnet_error(device_id):
|
|||
try:
|
||||
base_path = os.path.join(os.environ['CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY'],
|
||||
*"Image/CIFAR/v0/cifar-10-batches-py".split("/"))
|
||||
# N.B. CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY has {train,test}_map.txt
|
||||
# and CIFAR-10_mean.xml in the base_path.
|
||||
except KeyError:
|
||||
base_path = os.path.join(
|
||||
*"../../../../Examples/Image/DataSets/CIFAR-10/cifar-10-batches-py".split("/"))
|
||||
base_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
*"../../../../Examples/Image/DataSets/CIFAR-10".split("/"))
|
||||
|
||||
base_path = os.path.normpath(base_path)
|
||||
os.chdir(os.path.join(base_path, '..'))
|
||||
|
|
Загрузка…
Ссылка в новой задаче