Created
January 23, 2018 22:28
-
-
Save alseambusher/8694ad1eefbc68fd0082192958681c63 to your computer and use it in GitHub Desktop.
flatten deeplearn.js
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
/** | |
* Flattens an input tensor. | |
* @param inputs Tensor input | |
*/ | |
function flatten(inputs: Tensor) { | |
return g.reshape(inputs, (() => { | |
let i = 1; | |
inputs.shape.forEach((val) => { i *= val }); | |
return [i]; | |
})()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment