jiang1st commented on issue #6968: Is mxnet symbol support conditional control 
flow?
URL: 
https://github.com/apache/incubator-mxnet/issues/6968#issuecomment-359416026
 
 
   Hi, I am new to mxnet. Now I want to add some conditional control in my 
network. I notice that sym.where can do this work by:
   
   ```
   f_x = a - b
   f_y = a + b
   
   result = mx.sym.where(condition=gt, f_x, f_y)
   ```
   
   I am curious to know, in the above example, if the condition is true, will 
f_y=a+b be executed ? (maybe f_y is executed but the result will not be 
returned? )
   
   I read the example of tensorflow, the explanation is quite clear:
   
   ```
   z = tf.multiply(a, b)
   result = tf.cond(x < y, lambda: tf.add(x, z), lambda: tf.square(y))
   ```
   > If x < y, the tf.add operation will be executed and tf.square operation 
will not be executed.
   
   
   So, is mx.sym.where equivalent to tf.cond? Thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to