-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Add EmbeddingBag
#2031
Merged
Merged
Add EmbeddingBag
#2031
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
eccd097
embedding bag
mcognetta c437e2e
doc fix
mcognetta cbf8836
Apply suggestions from code review
mcognetta fbc9e4c
Remove references to `Statistics`
mcognetta f2e7e9d
non mutating bag and onehot changes
mcognetta 5373a41
better docs and todo
mcognetta 7be2fd0
input/offset docs
mcognetta baf5d15
doctest
mcognetta 1db1c42
Apply suggestions from code review
mcognetta a962695
reduce docs
mcognetta fdd1bb6
broadcast to map
mcognetta 5bca3b0
remove extra doc example line
mcognetta 6c04ecd
add _splitat
mcognetta 89db5f5
rename input/offset
mcognetta 4aa753e
minor docs
mcognetta 091fe71
Apply suggestions from code review
mcabbott a98c7a2
Update test/layers/basic.jl
mcabbott fcefac3
Update test/layers/basic.jl
mcabbott ba64701
Update test/layers/basic.jl
mcabbott 5bc01f5
typo
mcabbott 6878df8
Merge branch 'master' into embedding_bag
mcabbott fae30da
docstring
mcabbott 24dd98a
Apply suggestions from code review
mcabbott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be too general of a type restriction. For example, I could define a
MultiHot <: AbstractVector{Bool}
, that succinctly encodes a bag with fixedk
elements (in fact, this was one of my original use cases forEmbeddingBags
), and then if indexi
is true, it should be included in the bag.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a possible encoding. Dispatch on such a type specifically is not forbidden by this method.
So far, I think every other use of one-hot arrays behaves identically if you
collect
it. This is why I think it makes sense to define these methods forAbstractArray{Bool}
. Another boolean type with a different meaning cannot also have this property thatcollect
doesn't change the result.