haskell icon indicating copy to clipboard operation
haskell copied to clipboard

Searching for Condition

Open LeanderK opened this issue 6 years ago • 3 comments

is the equivalent of tf.cond somewhere? I am unable to find it...

LeanderK avatar Feb 19 '18 21:02 LeanderK

The closest I can think of is select. Can you make it work for your use case? If not, could you share more about your requirements and maybe somebody will have a suggestion for you?

blackgnezdo avatar Feb 20 '18 01:02 blackgnezdo

maybe it could work, but it's for control flow on the tensor-layer (what I mean is that it doesn't depend on the values of the elements of the tensors). I want to switch between different ways to execute my graph since my training and test environment are different.

LeanderK avatar Feb 20 '18 19:02 LeanderK

Not sure what you mean. Our select is the same as the python tf.where. Both tf.cond and tf.where act on the values of the predicate at graph execution time, but I think tf.cond has a guarantee that it will only evaluate one branch so that you can use it with mutating ops like tf.assign.

fkm3 avatar Feb 20 '18 20:02 fkm3