question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tf.ClipByValue() does not work as expected for the parameters (0, 1)

See original GitHub issue

TensorFlow.js version: 0.10.0

Google Chrome version: 66.0.3359.181

The tf.ClipByValue() function fails to clip the values in a tensor when clipValueMin is set to 0 and clipValueMax is set to 1.

let tensor = tf.range(0, 10)
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

let t_clip = tensor.clipByValue(0, 1)

t_clip.print()
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
// Spits out the same tensor without clipping the values

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Melvin-Abrahamcommented, Sep 17, 2018

Thanks, @nsthorat for pointing the use of old version of tensorflow.js. The issue seems to be solved in tfjs v0.13.0 for me…

tfjs_clip_codepen

Actually, as per my testing, the issue was already solved after the release of tfjs v0.11.7

1reaction
manrajgrovercommented, May 25, 2018

The code works fine for me for both webgl and cpu. This seems like an environment issue. Could you also add a screenshot of this page which might help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

tf.clip_by_value | TensorFlow v2.11.0
Given a tensor t , this operation returns a tensor of the same type and shape as t with its values clipped to...
Read more >
TensorFlow: Network output has not expected shape
I am expecting a (1,1) tensor object as output for my function multilayer_perceptron() , instead, when running pred , it returns a vector...
Read more >
Understanding Gradient Clipping (and How It Can Fix ...
Gradient Clipping solves one of the biggest problems that we have while calculating gradients in Backpropagation for a Neural Network.
Read more >
Tensorflow.js tf.clipByValue() Function - GeeksforGeeks
clipByValue() function is used to find the clip values of the stated tensor ... tf.clipByValue(x, clipValueMin, clipValueMax). Parameters:.
Read more >
<no title> — darts documentation - GitHub Pages
This parameter will be ignored for probabilistic models if the likelihood ... if self.trainer.global_step % 25 == 0: # don't make the tf...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found