Skip to content

Commit

Permalink
Config file beautifying
Browse files Browse the repository at this point in the history
wilrich-msft committed Apr 6, 2016
1 parent 9cd7b44 commit 7ad5ae4
Showing 4 changed files with 10 additions and 11 deletions.
7 changes: 2 additions & 5 deletions contrib/Python/cntk/context.py
Original file line number Diff line number Diff line change
@@ -8,10 +8,7 @@

from cntk.graph import ComputationNode
from cntk.ops.cntk1 import NewReshape
from cntk.utils import CNTK_EXECUTABLE_PATH


_FLOATX = 'float32'
from cntk.utils import CNTK_EXECUTABLE_PATH, MODEL_INDENTATION

CNTK_TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), "templates")
CNTK_TRAIN_TEMPLATE_PATH = os.path.join(
@@ -202,7 +199,7 @@ def _generate_eval_config(self, root_node, reader):
from .ops.cntk1 import Input
dummy_input_node = Input(2, var_name='dummy_node')
reader.add_input(dummy_input_node, 0, 2)
model_description += "dummy_node = Input(2, tag='output')"
model_description += "\n" + " "*MODEL_INDENTATION + "dummy_node = Input(2, tag='output')"
readers.append(reader)

tmpl = open(CNTK_EVAL_TEMPLATE_PATH, "r").read()
4 changes: 1 addition & 3 deletions contrib/Python/cntk/graph.py
Original file line number Diff line number Diff line change
@@ -2,13 +2,11 @@
import numpy as np
import scipy.sparse as sparse

from .utils import MODEL_INDENTATION

def _tuple_to_cntk_shape(shape):
return ':'.join(str(v) for v in shape)

# Indent model description by how many spaces
MODEL_INDENTATION = 8


class ComputationNode(object):

6 changes: 3 additions & 3 deletions contrib/Python/cntk/reader.py
Original file line number Diff line number Diff line change
@@ -76,10 +76,10 @@ def generate_config(self):
else:
name = name_or_node

template += '''\
template += '''
{0} = [
start = {1}
dim = {2}
dim = {2}
'''.format(name, start, dim)

if num_of_classes:
@@ -91,7 +91,7 @@ def generate_config(self):
labelMappingFile= "{0}"
'''.format(map_file)

template += '''\
template += '''
]
'''

4 changes: 4 additions & 0 deletions contrib/Python/cntk/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -5,3 +5,7 @@
"you need to point environmental variable 'CNTK_EXECUTABLE_PATH' to the CNTK binary")

CNTK_EXECUTABLE_PATH = os.environ['CNTK_EXECUTABLE_PATH']

# Indent model description by how many spaces
MODEL_INDENTATION = 8

0 comments on commit 7ad5ae4

Please sign in to comment.