To get help from the community, check out our Google group.
0.13.2
I'd like to request a feature reduce that cumulatively applies the math function onto each item in the Tensor and produce a new tensor with a new shape.
Such API might be invoked like
tf.tensor2d([[1, 2], [3, 4]]).add.reduce(0)
// column wise reduction
// Result: [4, 6]<tensor>
tf.tensor2d([[1, 2], [3, 4]]).add.reduce(1)
// Row wise reduction
// Result: [3, 7]<tensor>
This feature request is heavily influenced by https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.ufunc.reduce.html
This is alway i think, I totally agree with Jason
TF.js API is closely aligned with the TF Python API. Does such a reduce feature exist in TF Python?
I couldn't find a TF Python API that is close to reduce ;(
@JasonShin This should work:
const x = tf.tensor2d([[1, 2], [3, 4]]);
x.sum(axis=1).print(); // [3, 7]
You can read more about reduce operations here
@manrajgrover We were actually looking for both prod and sum methods but they weren't showing up on https://js.tensorflow.org/api/0.13.0/, which is the default doc site that the Google search result takes you to!
Ah, yes it does look like prod reduction op was recently added. Seems like this issue can be closed now!
/cc @dsmilkov
Most helpful comment
Ah, yes it does look like
prodreduction op was recently added. Seems like this issue can be closed now!/cc @dsmilkov