Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] change clip grad api, test=develop #2758

Merged
merged 6 commits into from
Oct 9, 2020
Merged

[DOC] change clip grad api, test=develop #2758

merged 6 commits into from
Oct 9, 2020

Conversation

qili93
Copy link
Contributor

@qili93 qili93 commented Oct 8, 2020

Change doc of 3 Clip apis.

Paddle PR: PaddlePaddle/Paddle#27767

@paddle-bot-old
Copy link

paddle-bot-old bot commented Oct 8, 2020

Thanks for your contribution!

@qili93
Copy link
Contributor Author

qili93 commented Oct 8, 2020

image

image

image

@qili93
Copy link
Contributor Author

qili93 commented Oct 8, 2020

image

image

image

ClipGradByValue
-------------------------------

.. py:class:: paddle.nn.ClipGradByValue(max, min=None, need_clip=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有need_clip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ClipGradByGlobalNorm
-------------------------------

.. py:class:: paddle.nn.ClipGradByGlobalNorm(clip_norm, group_name='default_group', need_clip=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该只有clip_norm吧 没有group_name、need_clip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确认过,保留group_name,删除need_clip


参数:
- **clip_norm** (float) - 所允许的范数最大值
- **group_name** (str, optional) - 剪切的组名
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有group_name吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确认过,保留group_name

ClipGradByNorm
-------------------------------

.. py:class:: paddle.nn.ClipGradByNorm(clip_norm, need_clip=None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有need_clip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@hong19860320 hong19860320 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hong19860320 hong19860320 merged commit d29f054 into PaddlePaddle:develop Oct 9, 2020
@qili93 qili93 deleted the clip_api branch October 9, 2020 05:29
RichardWooSJTU pushed a commit to RichardWooSJTU/docs that referenced this pull request Apr 8, 2022
This fix should allow for visualizing YOLOv5 model graphs correctly in Tensorboard by uncommenting line 335 in train.py:
```python
                    if tb_writer:
                        tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), [])  # add model graph
```

The problem was that the detect() layer checks the input size to adapt the grid if required, and tracing does not seem to like this shape check (even if the shape is fine and no grid recomputation is required). The following will warn:
https://github.com/ultralytics/yolov5/blob/0cae7576a9241110157cd154fc2237e703c2719e/train.py#L335

Solution is below. This is a YOLOv5s model displayed in TensorBoard. You can see the Detect() layer merging the 3 layers into a single output for example, and everything appears to work and visualize correctly.
```python
tb_writer.add_graph(torch.jit.trace(model, imgs, strict=False), [])
```
<img width="893" alt="Screenshot 2021-04-11 at 01 10 09" src="https://user-images.githubusercontent.com/26833433/114286928-349bd600-9a63-11eb-941f-7139ee6cd602.png">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants