Skip to content

Commit

Permalink
Merge 171c3ff into 5795029
Browse files Browse the repository at this point in the history
  • Loading branch information
Ram81 authored Feb 4, 2018
2 parents 5795029 + 171c3ff commit 771c7eb
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
13 changes: 12 additions & 1 deletion caffe_app/views/import_prototxt.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,16 @@ def ContrastiveLoss(layer):
return params


def Concat(layer):
params = {}
if (layer.concat_param.axis is not None):
params['axis'] = layer.concat_param.axis
else:
# default value for axis of concat in caffe
params['axis'] = 1
return params


# ********** Python Layer **********
def Python(layer):
params = {}
Expand Down Expand Up @@ -541,7 +551,8 @@ def Python(layer):
'Python': Python,
'LRN': LRN,
'LSTM': Recurrent,
'RNN': Recurrent
'RNN': Recurrent,
'Concat': Concat
}


Expand Down
24 changes: 24 additions & 0 deletions ide/static/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,24 @@ export default {
value: true,
type: 'checkbox',
required: false
},
rate: {
name: 'Dropout Ratio',
value: 0.5,
type: 'float',
required: false
},
seed: {
name: 'Seed',
value: 42,
type: 'number',
required: false
},
trainable: {
name: 'Trainable',
value: false,
type: 'checkbox',
required: false
}
},
props: {
Expand Down Expand Up @@ -3146,6 +3164,12 @@ export default {
value: true,
type: 'checkbox',
required: false
},
axis: {
name: 'Axis',
value: -1,
type: 'number',
required: false
}
},
props: {
Expand Down
13 changes: 11 additions & 2 deletions keras_app/views/layers_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ def Activation(layer):


def Dropout(layer):
return jsonLayer('Dropout', {}, layer)
params = {}
if (layer.rate is not None):
params['rate'] = layer.rate
if (layer.seed is not None):
params['seed'] = layer.seed
if (layer.trainable is not None):
params['trainable'] = layer.trainable
return jsonLayer('Dropout', params, layer)


def Flatten(layer):
Expand Down Expand Up @@ -370,7 +377,9 @@ def Embed(layer):

# ********** Merge Layers **********
def Concat(layer):
return jsonLayer('Concat', {}, layer)
params = {}
params['axis'] = layer.axis
return jsonLayer('Concat', params, layer)


def Eltwise(layer):
Expand Down
16 changes: 16 additions & 0 deletions tensorflow_app/views/import_graphdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,19 @@ def import_graph_def(request):
pass

elif layer['type'][0] == 'Concat':
if 'axis' in node.node_def.attr:
layer['params']['axis'] = node.get_attr('axis')
pass

elif layer['type'][0] == 'LRN':
if ('alpha' in node.node_def.attr):
layer['params']['alpha'] = node.get_attr('alpha')
if ('beta' in node.node_def.attr):
layer['params']['beta'] = node.get_attr('beta')
if ('local_size' in node.node_def.attr):
layer['params']['local_size'] = node.get_attr('depth_radius')
if ('bias' in node.node_def.attr):
layer['params']['k'] = node.get_attr('bias')
pass

elif layer['type'][0] == 'Softmax':
Expand All @@ -257,6 +267,12 @@ def import_graph_def(request):
pass

elif layer['type'][0] == 'Dropout':
if ('rate' in node.node_def.attr):
layer['params']['rate'] = node.get_attr('rate')
if ('seed' in node.node_def.attr):
layer['params']['seed'] = node.get_attr('seed')
if ('training' in node.node_def.attr):
layer['params']['trainable'] = node.get_attr('training')
pass
net = {}
batch_norms = []
Expand Down

0 comments on commit 771c7eb

Please sign in to comment.