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

Add RepeatVector layer #123

Closed
5 tasks
zaleslaw opened this issue Jun 15, 2021 · 5 comments · Fixed by #139
Closed
5 tasks

Add RepeatVector layer #123

zaleslaw opened this issue Jun 15, 2021 · 5 comments · Fixed by #139
Assignees
Labels
good first issue Good for newcomers
Milestone

Comments

@zaleslaw
Copy link
Collaborator

zaleslaw commented Jun 15, 2021

Currently, the support for RepeatVector is missed, and it would be great to add support for these layers. The desired PR addressing this issue should include:

  • Implementation of layer class named as RepeatVector (you can take inspiration from the implementation of Reshape as reference)
  • Documentation of layer and all non-private methods
  • JUnit tests in api module
  • Support for export of layer to JSON (see ModelSaver.kt)
  • Support for import of layer from JSON (see ModelLoader.kt)

Also, if needed, you can take a look at Keras documentation for RepeatVector

NOTE: for the moment, there is no need to add support for "data format" (i.e., channels last vs. channels first) in your PR; you can assume the channels are always in the last dimension.

P.S. If you want to take this ticket, please leave the comment below
P.P.S Read the Contributing Guidelines.

@zaleslaw zaleslaw added the good first issue Good for newcomers label Jun 15, 2021
@zaleslaw zaleslaw added this to the 0.3 milestone Jun 15, 2021
@dosier
Copy link
Contributor

dosier commented Jun 17, 2021

I could do this one :)

dosier added a commit to dosier/KotlinDL that referenced this issue Jun 18, 2021
dosier added a commit to dosier/KotlinDL that referenced this issue Jun 18, 2021
@dosier
Copy link
Contributor

dosier commented Jun 18, 2021

Hey @zaleslaw I am a bit lost on how best to write tests for RepeatVector class. Should I dig into the unit tests of Keras and convert them to Kotlin, or come up with tests myself?

@zaleslaw
Copy link
Collaborator Author

If the logic is simple, like in max pooling 2d layer, you could make it as you wish, if it includes complex calculations you could use some numerical data from keras, but you don't need make full copy of its tests, 1 or 2 for forward and main exceptions or cornerstones. Or you could use keras to pass input and get output of the tested layer.

dosier added a commit to dosier/KotlinDL that referenced this issue Jun 18, 2021
@dosier
Copy link
Contributor

dosier commented Jun 18, 2021

@zaleslaw alright. I added a simple test in dosier@bf61c5d. This is probably not enough though. What do u mean by cornerstones?

@zaleslaw
Copy link
Collaborator Author

hmm, maybe test for the negative number n=-10, for example, to get an IllegalArgumentException (you could use require in Kotlin for this)

dosier added a commit to dosier/KotlinDL that referenced this issue Jun 24, 2021
zaleslaw pushed a commit that referenced this issue Jun 24, 2021
* Added missing saving functions for ReLU and ELU activation layers (JetBrains#78)

* Reverted changes to the imports

* Added RepeatVector layer #123

* Added serialisation support for RepeatVector layer #123

* Wrote test for RepeatVector #123

* Made changed requested by avan (see desc.)
- added missing require check in init block of RepeatVector
- updated docs
- reformatted code
- housekeeping

* Removed redundant Obs.repeat ext fun

* Made changed requested by avan (see desc.)

- change require message in computeOutputShape
- used inputShape.size(...) for creating shape
- removed author tag

* Used `=` instead of `return` block, added TODO

* Implemented changes requested by zaleslaw

- save trainability status
- renamed tests

* Added test for negative `n` #123

* Added missing newline
@zaleslaw zaleslaw linked a pull request Jun 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants