提交 11c26069 编写于 作者: T Tao Luo 提交者: GitHub

Merge pull request #1401 from jacquesqiao/layer-run

Layer run
...@@ -22,7 +22,7 @@ import py_paddle.swig_paddle as api ...@@ -22,7 +22,7 @@ import py_paddle.swig_paddle as api
__all__ = [ __all__ = [
'optimizer', 'layer', 'activation', 'parameters', 'init', 'trainer', 'optimizer', 'layer', 'activation', 'parameters', 'init', 'trainer',
'event', 'data_type.py' 'event', 'data_type'
] ]
......
...@@ -66,12 +66,14 @@ Also, the creation of a protobuf message is hidden in the invocation of ...@@ -66,12 +66,14 @@ Also, the creation of a protobuf message is hidden in the invocation of
paddle.v2.parameters.create, no longer exposed to users. paddle.v2.parameters.create, no longer exposed to users.
""" """
import collections
import paddle.trainer_config_helpers as conf_helps import paddle.trainer_config_helpers as conf_helps
from . import data_type as v2_data
from paddle.trainer_config_helpers.config_parser_utils import \ from paddle.trainer_config_helpers.config_parser_utils import \
parse_network_config as __parse__ parse_network_config as __parse__
from paddle.trainer_config_helpers.default_decorators import wrap_name_default from paddle.trainer_config_helpers.default_decorators import wrap_name_default
import collections
import data_type
__all__ = [ __all__ = [
'parse_network', 'data', 'fc', 'max_id', 'classification_cost', 'parse_network', 'data', 'fc', 'max_id', 'classification_cost',
...@@ -166,7 +168,7 @@ So we also need to implement some special LayerV2. ...@@ -166,7 +168,7 @@ So we also need to implement some special LayerV2.
class DataLayerV2(Layer): class DataLayerV2(Layer):
def __init__(self, name, type, **kwargs): def __init__(self, name, type, **kwargs):
assert isinstance(type, v2_data.InputType) assert isinstance(type, data_type.InputType)
self.type = type self.type = type
self.__method_name__ = 'data_layer' self.__method_name__ = 'data_layer'
...@@ -198,8 +200,8 @@ cross_entropy_cost = __convert_to_v2__( ...@@ -198,8 +200,8 @@ cross_entropy_cost = __convert_to_v2__(
parent_names=['input', 'label']) parent_names=['input', 'label'])
if __name__ == '__main__': if __name__ == '__main__':
pixel = data(name='pixel', type=v2_data.dense_vector(784)) pixel = data(name='pixel', type=data_type.dense_vector(784))
label = data(name='label', type=v2_data.integer_value(10)) label = data(name='label', type=data_type.integer_value(10))
hidden = fc(input=pixel, size=100, act=conf_helps.SigmoidActivation()) hidden = fc(input=pixel, size=100, act=conf_helps.SigmoidActivation())
inference = fc(input=hidden, size=10, act=conf_helps.SoftmaxActivation()) inference = fc(input=hidden, size=10, act=conf_helps.SoftmaxActivation())
maxid = max_id(input=inference) maxid = max_id(input=inference)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册