Skip to content

Instantly share code, notes, and snippets.

@JustASquid
Last active January 10, 2023 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustASquid/376ecc8f6469fb5a4262941c293352ab to your computer and use it in GitHub Desktop.
Save JustASquid/376ecc8f6469fb5a4262941c293352ab to your computer and use it in GitHub Desktop.
def f(x):
# x has a shape of (batch, 5) with range [0, 1)
a = tf.constant([
2324.346923828125,
2324.346923828125,
1325.14990234375,
1325.14990234375,
1365.2352294921875
])
x_scaled = (100 * (1 - x) + 10000 * x)
return tf.math.reduce_max(a / x_scaled, axis=-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment