Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 74d6808f authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Adjust TensorflowVector square and square root computations.

For some reason, `tf.square(x)` and `tf.pow(x, 2)` can result in
distinct values for small-enough values of x. The same is true of
`tf.sqrt(x)` and `tf.pow(x, 0.5)`.

This commit ensures the `tf.sqrt` and `tf.square` functions are
used in these two edge cases for the `vector ** p` syntax. This
choice is motivated by the fact that these functions are used
in most official tensorflow / keras code, and seem to be closer
to their torch counterparts (which are equivalent to `vec ** p`)
than `tf.pow` - based on a few local tests.
parent 3c82f5ce
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment