You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 15, 2019. It is now read-only.
This PR adds `avgPool3d` op & `maxPool3d` op with CPU and WebGL implementation, supports inference and gradient. The APIs align with TensorFlow’s Python API [tf.nn.avg_pool3d](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/nn/avg_pool3d) and [tf.nn.max_pool3d](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/nn/max_pool3d). The `avgPool3d` & `maxPool3d` ops support `tf.layers.averagePooling3d` & `tf.layers.maxPooling3d` (feature requested in [tensorflow/tfjs#1035](tensorflow/tfjs#1035)).
As a checklist, features in this PR:
* Add `tf.avgPool3d` to ops
* Add `tf.maxPool3d` to ops
* Add `avgPool3d` kernel to handle `tf.avgPool3d`’s prediction
* Add `maxPool3d` kernel to handle `tf.maxPool3d`’s prediction
* Add private helper `pool3d` function in CPU kernel as the implementation of `avgPool3d` kernel and `maxPool3d` kernel in CPU end
* Add `Pool3DProgram` in WebGL kernel as the implementation of `avgPool3d` kernel and `maxPool3d` kernel in GPU end
* Add `avgPool3dBackprop` kernel to handle `tf.avgPool3d`’s gradient
* Add `avgPool3dBackprop` CPU kernel implementation
* Add `AvgPool3DBackpropProgram` as the implementation of `avgPool3dBackprop` WebGL kernel
* Add `maxPool3dBackprop` kernel to handle `tf.maxPool3d`’s gradient
* Add `maxPool3dBackprop` CPU kernel implementation
* Add a private helper function `maxPool3dPositions` for maxPool3dBackprop in CPU kernel
* Add `MaxPool3DBackpropProgram` as the implementation of `maxPool3dBackprop` WebGL kernel
* Integrate WebGL end’s `maxPool3dPositions` helper function into Pool3DProgram
* Add a `computePool3DInfo` util function to compute operation information for `avgPool3d` & `maxPool3d`
* Make check function `eitherStridesOrDilationsAreOne` support 3D input
* Add 14 unit tests for `avgPool3d` (one test case failed in nodejs env as TF Backend doesn’t support `NUMBER` pad mode)
* Add 7 unit tests for `avgPool3dBackprop`
* Add 13 unit tests for `maxPool3d` (one test case failed in nodejs env as TF Backend doesn’t support `NUMBER` pad mode)
* Add 10 unit tests for `maxPool3dBackprop`
* Add 8 unit tests for util function `computePool3DInfo`
* Export `Tensor5D `type
* Add jsdocs and executable examples for website api documentation
I built a local website, if everything goes well, the `avgPool3d` and `maxPool3d` APIs would lie in `Operations/Convolution` section and look like the screen shot below:
<img width="1184" alt="Screen Shot 2019-06-06 at 1 32 30 AM" src="https://user-images.githubusercontent.com/7977100/59018883-c13c3400-87fb-11e9-8f36-316edab35231.png">
**Relative PRs:**
* Make nodejs kernel support avgPool3d & maxPool3d [tensorflow/tfjs-node#256](tensorflow/tfjs-node#256)
* Add averagePooling3d layer & maxPooling3d layer [tensorflow/tfjs-layers#555](tensorflow/tfjs-layers#555)
* Add avgPool3d & maxPool3d ops for graph model [tensorflow/tfjs-converter#375](tensorflow/tfjs-converter#375)
**Reference:**
* [tf.nn.avg_pool3d TensorFlow Python API](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/nn/avg_pool3d)
* [tf.nn.max_pool3d TensorFlow Python API](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/nn/max_pool3d)
---
To see the logs from the Cloud Build CI, please join either
our [discussion](https://groups.google.com/a/tensorflow.org/forum/#!forum/tfjs)
or [announcement](https://groups.google.com/a/tensorflow.org/forum/#!forum/tfjs-announce) mailing list.
FEATURE
0 commit comments