diff --git a/parl/__init__.py b/parl/__init__.py index eca2dce114b069bf9b455d77ce670d73b5047fd2..cec8b257112c61ff2fb6a1bb80a9afa8fb698d9c 100644 --- a/parl/__init__.py +++ b/parl/__init__.py @@ -11,3 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" +generates new PARL python API +""" +from parl.framework import * +from parl.utils import * +from parl.plutils import * diff --git a/parl/framework/__init__.py b/parl/framework/__init__.py index eca2dce114b069bf9b455d77ce670d73b5047fd2..8ca1bb94f824299e3cd432f1f46f9f7574a2e04e 100644 --- a/parl/framework/__init__.py +++ b/parl/framework/__init__.py @@ -11,3 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from parl.framework.model_base import * +from parl.framework.algorithm_base import * +from parl.framework.agent_base import * diff --git a/parl/framework/computation_task.py b/parl/framework/agent_base.py similarity index 88% rename from parl/framework/computation_task.py rename to parl/framework/agent_base.py index aca2a8d56ad3d800828ddbbf846af6e581e725df..3c3232792840837f17dc68248f9aede1b6b50623 100644 --- a/parl/framework/computation_task.py +++ b/parl/framework/agent_base.py @@ -15,20 +15,20 @@ import paddle.fluid as fluid import parl.layers as layers from parl.framework.algorithm_base import Algorithm -from parl.framework.base import Model +from parl.framework.model_base import Model -__all__ = ['ComputationTask'] +__all__ = ['Agent'] -class ComputationTask(object): +class Agent(object): """ - A ComputationTask is responsible for the general data flow + A Agent is responsible for the general data flow outside the algorithm. - A ComputationTask is created in a bottom-up way: + A Agent is created in a bottom-up way: a. create a Model b. create an Algorithm with the model as an input - c. define a ComputationTask with the algorithm + c. define a Agent with the algorithm """ def __init__(self, algorithm): @@ -68,6 +68,6 @@ class ComputationTask(object): def learn(self, obs, action, reward, next_obs, terminal): """pass data to the training program to update model, - this function is the training interface for ComputationTask. + this function is the training interface for Agent. """ raise NotImplementedError diff --git a/parl/layers/__init__.py b/parl/layers/__init__.py index a615ae1d96b20a5dfe0a31adad28770dd232f283..fd86c43c229ffc9a37385162b012782a41792132 100644 --- a/parl/layers/__init__.py +++ b/parl/layers/__init__.py @@ -16,4 +16,4 @@ This file wraps Fluid layers that have parameters to support parameter sharing. For other layers that don't have parameters, we simply copy them to this namespace. """ from paddle.fluid.layers import * -from .layer_wrappers import * +from parl.layers.layer_wrappers import * diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..c0967333c4ac1b79a3ab7fb1eb4696f662cd1701 --- /dev/null +++ b/setup.py @@ -0,0 +1,35 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os +import re +from setuptools import setup, find_packages + + +def _find_packages(prefix=''): + packages = [] + path = '.' + prefix = prefix + for root, _, files in os.walk(path): + if '__init__.py' in files: + packages.append(re.sub('^[^A-z0-9_]', '', root.replace('/', '.'))) + return packages + + +setup( + name='parl', + version=0.1, + packages=_find_packages(), + package_data={'': ['*.so']})