You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+149-7
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,18 @@
1
1
# TensorLayer Contributor Guideline
2
2
3
+
## Welcome to contribute!
4
+
You are more than welcome to contribute to TensorLayer! If you have any improvement, please send us your [pull requests](https://help.github.com/en/articles/about-pull-requests). You may implement your improvement on your [fork](https://help.github.com/en/articles/working-with-forks).
5
+
6
+
## Checklist
7
+
* Continuous integration
8
+
* Build from sources
9
+
* Unittest
10
+
* Documentation
11
+
* General intro to TensorLayer2
12
+
* How to contribute a new `Layer`
13
+
* How to contribute a new `Model`
14
+
* How to contribute a new example/tutorial
15
+
3
16
## Continuous integration
4
17
5
18
We appreciate contributions
@@ -24,8 +37,8 @@ to apply those tools before submitting your PR.
24
37
25
38
```bash
26
39
# First clone the repository and change the current directory to the newly cloned repository
# a dynamic model allows more flexibility by customising forwarding.
156
+
defforward(self, x, bar=None):
157
+
d1 =self.dense1(x)
158
+
if bar:
159
+
return d1
160
+
else:
161
+
d2 =self.dense2(d1)
162
+
return d1, d2
163
+
164
+
model = CustomizeModel()
165
+
```
166
+
* More examples can be found in [examples](examples/) and [tests/layers](tests/layers/). Note that not all of them are completed.
167
+
168
+
## How to contribute a new `Layer`
169
+
* A `NewLayer` should be a derived from the base class [`Layer`](tensorlayer/layers/core.py).
170
+
* Member methods to be overrided:
171
+
-`__init__(self, args1, args2, inputs_shape=None, name=None)`: The constructor of the `NewLayer`, which should
172
+
- Call `super(NewLayer, self).__init__(name)` to construct the base.
173
+
- Define member variables based on the args1, args2 (or even more).
174
+
- If the `inputs_shape` is provided, call `self.build(inputs_shape)` and set `self._built=True`. Note that sometimes only `in_channels` should be enough to build the layer like [`Dense`](tensorlayer/layers/dense/base_dense.py).
175
+
- Logging by `logging.info(...)`.
176
+
-`__repr__(self)`: Return a printable representation of the `NewLayer`.
177
+
-`build(self, inputs_shape)`: Build the `NewLayer` by defining weights.
178
+
-`forward(self, inputs, **kwargs)`: Forward feeding the `NewLayer`. Note that the forward feeding of some `Layers` may be different during training and testing like [`Dropout`](tensorlayer/layers/dropout.py).
179
+
* Unittest:
180
+
- Unittest should be done before a pull request. Unittest code can be written in [tests/](tests/)
181
+
* Documents:
182
+
- Please write a description for each class and method in RST format. The description may include the functionality, arguments, references, examples of the `NewLayer`.
* A `NewModel` should be derived from the base class [`Model`](tensorlayer/models/core.py) (if dynamic) or an instance of [`Model`](tensorlayer/models/core.py) (if static).
187
+
* A static `NewModel` should have fixed inputs and outputs. Please check the example [`VGG_Static`](tensorlayer/models/vgg.py)
188
+
* A dynamic `NewModel` has more flexiblility. Please check the example [`VGG16`](tensorlayer/models/vgg16.py)
189
+
190
+
## How to contribute a new example/tutorial
191
+
* A new example/tutorial should implement a complete workflow of deep learning which includes (but not limited)
0 commit comments