diff --git a/doc/api/v2/model_configs.rst b/doc/api/v2/model_configs.rst index a9f33b33ef61bf846013364672ec26ae075d0300..4ca28315d5564c9a67db0fd65a15a4519ca39168 100644 --- a/doc/api/v2/model_configs.rst +++ b/doc/api/v2/model_configs.rst @@ -4,3 +4,11 @@ Layers .. automodule:: paddle.v2.layer :members: + + +========== +Attributes +========== + +.. automodule:: paddle.v2.attr + :members: diff --git a/python/paddle/v2/attr.py b/python/paddle/v2/attr.py index 40c64f621b443d5613468b27d030ab08776641b2..32f78614e7f8abe7cffdc7a50a9fa77f1fc1a780 100644 --- a/python/paddle/v2/attr.py +++ b/python/paddle/v2/attr.py @@ -12,12 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.trainer_config_helpers.attrs import * +import paddle.trainer_config_helpers.attrs __all__ = [ "Param", "Extra", ] -Param = ParameterAttribute -Extra = ExtraLayerAttribute +Param = paddle.trainer_config_helpers.attrs.ParameterAttribute +Extra = paddle.trainer_config_helpers.attrs.ExtraLayerAttribute + +for each in paddle.trainer_config_helpers.attrs.__all__: + globals()[each] = getattr(paddle.trainer_config_helpers.attrs, each) + __all__.append(each) diff --git a/python/paddle/v2/config_base.py b/python/paddle/v2/config_base.py index 64de568fcc74cb6b1f8c45b5d039d231f3dda8b0..1ec1d7bbdf912b940ca4b8e7b20eb11310f0e74f 100644 --- a/python/paddle/v2/config_base.py +++ b/python/paddle/v2/config_base.py @@ -42,6 +42,12 @@ class LayerType(type): # replace LayerOutput to paddle.v2.config_base.Layer doc = doc.replace("LayerOutput", "paddle.v2.config_base.Layer") + doc = doc.replace('ParameterAttribute', + 'paddle.v2.attr.ParameterAttribute') + + doc = re.sub(r'ExtraLayerAttribute[^\s]?', + 'paddle.v2.attr.ExtraAttribute', doc) + # xxx_layer to xxx doc = re.sub(r"(?P[a-z]+)_layer", r"\g", doc)