-
Notifications
You must be signed in to change notification settings - Fork 6.8k
tf.boolean_mask equivalent in MxNet #7443
Comments
To refine the question a bit more; is it possible in MxNet, ideally by using the Symbol API, to select a subset of the samples in a minibatch, based on a binary condition vector? For example given a tensor of the shape (A,B,C,D) and a binary vector of the shape (A,),I want to produce a new tensor of the shape (a,B,C,D), where |
mx.nd.pick |
According to the documentation, `x = [[ 1., 2.], // picks elements with specified indices along axis 0 In my case, I don't have the knowledge of the indices in |
x = mx.nd.array([1,2,3,4,5]) output: ... [ 1. 2. 3. 2. 1.] |
Is there a way to filter out the elements in x = mx.nd.array([1,2,3,4,5]) Will give [1. 2.] as the output, since only the first two elements satisfy x < y |
Actually, you can transform the nd to np.array with .asnumpy(), and then use numpy to do that. Slicing is not mature in mxnet. |
That is the problem; I am using a lot of glue code to implement this conditional behavior for minibatches. I keep the track of the sample indices, select ones which satisfy a certain condition and route them into separate network subsets. I am using .asnumpy() conversion and use multiple sub-networks and executors for this purpose. This costs me nearly a ten folds slower execution compared to baselines. Any chance that slicing will be improved in the near future? |
You can use Anaconda Python to accelerate the calculation of numpy as it is compiled with the Intel MKL. You may got less performance loss. |
This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks! |
More than two years later, it seems like MXNet still doesn't support Boolean Index? |
As part of #14253 there is support / is in progress |
In my architecture, I want to pick same of the samples in a minibatch at different stages of computation, based on a binary vector produced elsewhere in the network. In Tensorflow, tf.boolean_mask is generally used for that purpose. How can I achieve the similar effect in MxNet, is it possible?
The text was updated successfully, but these errors were encountered: