java icon indicating copy to clipboard operation
java copied to clipboard

not found reducemean and tf.norm and tf.argsort method, if we support these operation in java or not?

Open mullerhai opened this issue 3 years ago • 4 comments
trafficstars

HI

not found reducemean and tf.argsort and tf.norm for L1 or L2 method, if we support these operation in java or not?

mullerhai avatar Feb 20 '22 02:02 mullerhai

Our tf.math.mean operation can be configured to do reduce_mean, depending on how keep_dims and the other arguments are set. There is a euclidean (L2) norm built in, but L1 will need to be composed out of abs and reduceSum. Argsort needs to be built out of the TopK operation, you can see how they do that in Python here https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/sort_ops.py#L186.

Craigacp avatar Feb 20 '22 03:02 Craigacp

Our tf.math.mean operation can be configured to do reduce_mean, depending on how keep_dims and the other arguments are set. There is a euclidean (L2) norm built in, but L1 will need to be composed out of abs and reduceSum. Argsort needs to be built out of the TopK operation, you can see how they do that in Python here https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/sort_ops.py#L186.

thank you, but now I also have new question: the meshgrid operate method not found

mullerhai avatar Feb 20 '22 03:02 mullerhai

scatter_nd operate do we support? I found Scatter.class

mullerhai avatar Feb 20 '22 03:02 mullerhai

In general we only expose the ops which exist in the TensorFlow C API. If an op exists in Python but not in the C API then it means the op is composed out of multiple more primitive ops. So you can look up the op (https://www.tensorflow.org/api_docs/python/tf/meshgrid) and view the source (https://github.com/tensorflow/tensorflow/blob/v2.8.0/tensorflow/python/ops/array_ops.py#L3636-L3714) for it to see how that op is built. Meshgrid looks relatively simple to build from ops we do have.

ScatterNd is available in TF-Java here https://www.tensorflow.org/jvm/api_docs/java/org/tensorflow/op/core/ScatterNd.

Craigacp avatar Feb 20 '22 04:02 Craigacp