提交 aa581082 编写于 作者: X xiexionghang

fix code style

上级 b380a55f
......@@ -95,8 +95,14 @@ class ModelBuilder:
main_program = fluid.Program()
startup_program = fluid.Program()
with fluid.program_guard(main_program, startup_program):
#TODO return dict maybe better ?
input_accessor, sparses, inputs, outputs, monitors = self._inference()
#input_accessor, sparses, inputs, outputs, monitors
inference_info = self._inference()
inputs = inference_info['inputs']
outputs = inference_info['outputs']
sparses = inference_info['sparses']
monitors = inference_info['monitors']
input_accessor = inference_info['accessors']
test_program = main_program.clone(for_test=True)
loss, labels = self._loss_function(*outputs)
......@@ -149,7 +155,7 @@ class ModelBuilder:
'loss': loss.name,
'input_accessor': input_accessor,
'monitor': monitors,
'aa_Attention' : 'Do Not Modify This File Manually, Unless You Really Know It'
'aa_Attention': 'Do Not Modify This File Manually, Unless You Really Know It'
}
with open(model_desc_path, 'w') as f:
......
......@@ -32,7 +32,7 @@ def inference():
net = fluid.layers.fc(net, 128, act='relu', name='fc_7')
ctr_output = fluid.layers.fc(net, 1, act='sigmoid', name='ctr')
return [], [], [cvm_input], [ctr_output], monitors
return {'accessors': [], 'monitors': [], 'sparses': [], 'inputs': [cvm_input], 'outputs': [ctr_output]}
def loss_function(ctr_output):
"""
......
......@@ -50,7 +50,7 @@ def inference():
{ "name": "epoch_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 600 },
{ "name": "day_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 86400 }
]
return accessors, [sparse_cvm], [cvm_input], [ctr_output], monitors
return {'accessors': accessors, 'monitors': monitors, 'sparses': [sparse_cvm], 'inputs': [cvm_input], 'outputs': [ctr_output]}
def loss_function(ctr_output):
"""
......
......@@ -100,8 +100,7 @@ labels:
shape: [-1, 1]
loss: loss_ctr
monitor:
- {class: AucMonitor, compute_interval: 3600, name: epoch_auc, target: ctr.tmp_2,
target_idx: 0}
- {class: AucMonitor, compute_interval: 600, name: epoch_auc, target: ctr.tmp_2, target_idx: 0}
- {class: AucMonitor, compute_interval: 86400, name: day_auc, target: ctr.tmp_2, target_idx: 0}
outputs:
- name: ctr.tmp_2
......
......@@ -81,8 +81,7 @@ labels:
shape: [-1, 1]
loss: loss_ctr
monitor:
- {class: AucMonitor, compute_interval: 3600, name: epoch_auc, target: ctr.tmp_2,
target_idx: 0}
- {class: AucMonitor, compute_interval: 600, name: epoch_auc, target: ctr.tmp_2, target_idx: 0}
- {class: AucMonitor, compute_interval: 86400, name: day_auc, target: ctr.tmp_2, target_idx: 0}
outputs:
- name: ctr.tmp_2
......
......@@ -43,7 +43,7 @@ def inference():
{ "name": "day_auc", "class": "AucMonitor", "target": ctr_output, "compute_interval": 86400 }
]
return accessors, [sparse_cvm], [cvm_input], [ctr_output], monitors
return {'accessors': accessors, 'monitors': monitors, 'sparses': [sparse_cvm], 'inputs': [cvm_input], 'outputs': [ctr_output]}
def loss_function(ctr_output):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册