-
Notifications
You must be signed in to change notification settings - Fork 105
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 AvgPool3D layer #99
Conversation
*/ | ||
public class AvgPool3D( | ||
public val poolSize: IntArray = intArrayOf(2, 2, 2), | ||
public val strides: IntArray? = null, |
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.
set the default value for the strides and convert both, strides and poolSize to the 5d array of longs
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.
Conversion was done, and I have mentioned the benefit of using null
as the default value for strides.
api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt
Outdated
Show resolved
Hide resolved
api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt
Outdated
Show resolved
Hide resolved
api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt
Outdated
Show resolved
Hide resolved
api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt
Outdated
Show resolved
Hide resolved
@zaleslaw I just merged it with master branch and updated it with recent/requested changes. |
api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt
Outdated
Show resolved
Hide resolved
api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt
Outdated
Show resolved
Hide resolved
arrayOf( | ||
arrayOf( | ||
arrayOf( | ||
floatArrayOf(18.0f/8, 4.5f/8, 16.0f/8), |
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.
did you take these values from Keras tests?
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.
No, I created the test data myself :)
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.
Not bad:)
Sometimes I just copied test data from Keras; sometimes, if test data seems not appropriate, I use Keras like a test machine writing some simple test in Python to put some test data in inputs and get outputs. A few times, I ignored this method and just used tested primitive itself to get data, but it has a bug in implementation and, as a result, a wrong test:(( But I agree that test inputs/outputs for pooling could be calculated manually (just shared my experience)
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.
Yeah, actually I have created test data for all test cases I have written so far; but certainly it's not a sustainable approach and using another tested tool, like Keras or maybe even numpy, for generating test data seems to be a better and more reliable approach.
@zaleslaw I changed the strides type and default value per your request. |
Resolves #81. This PR adds support for AvgPool3D layer.
NOTE: as commented in the unit tests, currently it gives an error when
dataFormat = CHANNELS_FIRST
.