Automatically unwrap attributes access of _LiteModule (#5392)

* automatically unwrap attributes access of _LiteModule and add test for it
* delete redundant documents
This commit is contained in:
Yishuo Wang 2022-08-18 10:57:52 +08:00 committed by GitHub
parent df75c72d91
commit e62b8d1fc5

View file

@ -111,7 +111,6 @@ We only need the following steps:
- copy all lines of code into the `train` method of `MyNano`
- add one line to setup model, optimizer and dataloader
- replace the `loss.backward()` with `self.backward(loss)`
- (**optional, only required when you use custom fields or methods of the model**) after calling `self.setup`, the returned model is a wrapper module around the original one which only has some common methods, such as `train`, `forward`, etc. if you need to access other fields or methods of the original model, you can replace the `model.xxxx` with `model.module.xxxx`
```python
import os