Improve docs for custom events#1587
Merged
vfdev-5 merged 13 commits intopytorch:masterfrom Feb 2, 2021
jrieke:master
Merged
Conversation
vfdev-5
reviewed
Jan 28, 2021
docs/source/concepts.rst
Outdated
| @engine.on(Events.STARTED) | ||
| def fire_custom_events(engine): | ||
| engine.fire_event(CustomEvents.CUSTOM_STARTED) | ||
| engine.state.custom_started += 1 # increase state counter for this event (required) |
Collaborator
There was a problem hiding this comment.
Let's say this is required for filtering only and can be omitted if no filtering is done. And another note to add is that this is a temporary solution and subject to change in future releases.
docs/source/concepts.rst
Outdated
| engine.register_events(*CustomEvents) | ||
| engine.register_events( | ||
| *CustomEvents, | ||
| event_to_attr={ |
Collaborator
There was a problem hiding this comment.
This part is not required actually. I'd put everything in the following way:
- simple custom events without filtering (current doc)
- custom events with filtering:
- engine.state should have corresponding attributes
- event_to_attr is required when
register_events - should increase counters (subject to be removed)
Contributor
Author
|
@vfdev-5 Ok I restructured it as you suggested. I removed all changes from the original docs and added the 3 steps for filtering as a paragraph below it. |
vfdev-5
reviewed
Feb 2, 2021
Collaborator
There was a problem hiding this comment.
Few more comments
Btw, you can see the rendering at https://deploy-preview-1587--pytorch-ignite-preview.netlify.app/concepts.html
Co-authored-by: vfdev <[email protected]>
Co-authored-by: vfdev <[email protected]>
Co-authored-by: vfdev <[email protected]>
Co-authored-by: vfdev <[email protected]>
Co-authored-by: vfdev <[email protected]>
Co-authored-by: vfdev <[email protected]>
vfdev-5
reviewed
Feb 2, 2021
vfdev-5
reviewed
Feb 2, 2021
vfdev-5
approved these changes
Feb 2, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1555
Description: Improved the docs on how to create custom events according to the example in #1555.
Check list: