You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warn when calling session.run() on a very large scatter #360
Scatter ops output a ref to the whole tensor for easier chaining. The problem is if one executes the op directly in Session.run() the whole tensor is copied back as a numpy array. This can create very annoying and hard to find performance problems. I think you should consider adding a warning.
Most computational operations, when expressed in our python API, return a tf.Tensor object, and passing a Tensor object to session.run does indeed fetch the result back -- you can just run the operation by passing set3_op.op instead.
changed the title [-]scatter_ops can cause one to accidentally copy a large tensor[/-][+]Warn when calling session.run() on a very large tensor[/+]on Dec 13, 2015
I don't think it's practical to have a warning like this, unfortunately. Calling session.run() on large tensors seems like pretty standard behavior for machine learning.
will return the whole value of "large_table" as a NumPy array although it updates a small part of it. This can cause a nasty hard-to-find performance problem. I think it is reasonable to have a warning when
on of the fetch operations in session.run is scatter_*.
changed the title [-]Warn when calling session.run() on a very large tensor[/-][+]Warn when calling session.run() on a very large scatter[/+]on Mar 9, 2016
Incidentally, it would be better to fix the performance issue entirely. There are a couple possible ways to do that, though I'm not sure if any are practical:
Automatically replace scatter with scatter.op in session.run.
Same as (1), but on the C++ side somehow.
Return views into the tensor rather than the whole thing.
@michaelisard: Do any of these seem sane / practical?
Hi @bdaskalov ,
We are checking to see if you still need help on this issue. We recommend that you upgrade your code base to 2.x versions following migration document and let us know if the issue still persists in newer versions. Thanks!
Activity
vrv commentedon Nov 26, 2015
Sure, we'll take that into consideration.
Most computational operations, when expressed in our python API, return a tf.Tensor object, and passing a Tensor object to session.run does indeed fetch the result back -- you can just run the operation by passing set3_op.op instead.
[-]scatter_ops can cause one to accidentally copy a large tensor[/-][+]Warn when calling session.run() on a very large tensor[/+]girving commentedon Mar 8, 2016
I don't think it's practical to have a warning like this, unfortunately. Calling
session.run()on large tensors seems like pretty standard behavior for machine learning.bdaskalov commentedon Mar 9, 2016
@girving I was still learning Tensorflow at the time I filed this so I guess I didn't phrase it properly.
The problem is that tf.scatter_update/add/sub() Ops return the whole tensor although they are typically used to update only a small part of it.
For example:
session.run([tf.scatter_update(large_table, 3, [1,2,3]))
will return the whole value of "large_table" as a NumPy array although it updates a small part of it. This can cause a nasty hard-to-find performance problem. I think it is reasonable to have a warning when
on of the fetch operations in session.run is scatter_*.
[-]Warn when calling session.run() on a very large tensor[/-][+]Warn when calling session.run() on a very large scatter[/+]girving commentedon Mar 9, 2016
Fair enough, I was a bit misled by the title change. Reopening.
girving commentedon Mar 9, 2016
Incidentally, it would be better to fix the performance issue entirely. There are a couple possible ways to do that, though I'm not sure if any are practical:
scatterwithscatter.opinsession.run.@michaelisard: Do any of these seem sane / practical?
tensorflowbutler commentedon Dec 22, 2017
It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.
1 remaining item
tensorflowbutler commentedon Jan 24, 2018
Please remove the assignee, as this issue is inviting external contributions. Otherwise, remove the
contributions welcomelabel. Thank you.tensorflowbutler commentedon Feb 8, 2018
Please remove the assignee, as this issue is inviting external contributions. Otherwise, remove the
contributions welcomelabel. Thank you.bhack commentedon Sep 8, 2020
Is this still valid? Also
tf.scatter_updateis deprecated.mohantym commentedon Sep 23, 2021
Hi @bdaskalov ,
We are checking to see if you still need help on this issue. We recommend that you upgrade your code base to 2.x versions following migration document and let us know if the issue still persists in newer versions. Thanks!
bdaskalov commentedon Sep 23, 2021
mohantym commentedon Sep 24, 2021
@bdaskalov ,Thanks for confirming the same!
mohantym commentedon Feb 11, 2022
Are you satisfied with the resolution of your issue?
Yes
No
Update XNNPACK in XLA