Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 76ed2a40 authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Improve 'declearn.model' docstring and add some missing '__all__'.

parent 3d63f26d
No related branches found
No related tags found
1 merge request!15Implement framework-specific OptiModule subclasses.
Pipeline #761161 passed
...@@ -19,8 +19,25 @@ ...@@ -19,8 +19,25 @@
This declearn submodule provides with: This declearn submodule provides with:
* Model and Vector abstractions, used as an API to design FL algorithms * Model and Vector abstractions, used as an API to design FL algorithms
* Submodules implementing interfaces to curretnly supported frameworks * Submodules implementing interfaces to various frameworks and models.
and models.
The automatically-imported submodules implemented here are:
* api: Model and Vector abstractions' defining module.
- Model: abstract API to interface framework-specific models.
- Vector: abstract API for data tensors containers.
* sklearn: scikit-learn based or oriented tools
- NumpyVector: Vector for numpy array data structures.
- SklearnSGDModel: Model for scikit-learn's SGDClassifier and SGDRegressor.
The optional-dependency-based submodules that may be manually imported are:
* tensorflow: tensorflow-interfacing tools
- TensorflowModel: Model to wrap any tensorflow-keras Layer model.
- TensorflowOptiModule: Hacky OptiModule to wrap a keras Optimizer.
- TensorflowVector: Vector for tensorflow Tensor and IndexedSlices.
* torch: pytorch-interfacing tools
- TorchModel: Model to wrap any torch Module model.
- TorchOptiModule: Hacky OptiModule to wrap a torch Optimizer.
- TorchVector: Vector for torch Tensor objects.
""" """
from . import api from . import api
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""Model Vector abstractions submodule.""" """Model and Vector abstractions submodule."""
from ._vector import Vector, register_vector_type from ._vector import Vector, register_vector_type
from ._model import Model from ._model import Model
......
...@@ -25,6 +25,7 @@ from typing_extensions import Self # future: import from typing (Py>=3.11) ...@@ -25,6 +25,7 @@ from typing_extensions import Self # future: import from typing (Py>=3.11)
from declearn.model.api._vector import Vector, register_vector_type from declearn.model.api._vector import Vector, register_vector_type
__all__ = [ __all__ = [
"NumpyVector", "NumpyVector",
] ]
......
...@@ -37,6 +37,11 @@ from declearn.model.tensorflow.utils import ( ...@@ -37,6 +37,11 @@ from declearn.model.tensorflow.utils import (
from declearn.utils import get_device_policy from declearn.utils import get_device_policy
__all__ = [
"TensorflowVector",
]
@register_vector_type(tf.Tensor, EagerTensor, tf.IndexedSlices) @register_vector_type(tf.Tensor, EagerTensor, tf.IndexedSlices)
class TensorflowVector(Vector): class TensorflowVector(Vector):
"""Vector subclass to store tensorflow tensors. """Vector subclass to store tensorflow tensors.
......
...@@ -29,6 +29,11 @@ from declearn.model.torch.utils import select_device ...@@ -29,6 +29,11 @@ from declearn.model.torch.utils import select_device
from declearn.utils import get_device_policy from declearn.utils import get_device_policy
__all__ = [
"TorchVector",
]
@register_vector_type(torch.Tensor) @register_vector_type(torch.Tensor)
class TorchVector(Vector): class TorchVector(Vector):
"""Vector subclass to store PyTorch tensors. """Vector subclass to store PyTorch tensors.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment