Not able to able to understand mx.symbol.take()? Example
eq_flag = mx.sym.Variable(name="eq_flag") select_conv_feat = mx.sym.take(mx.sym.Concat(*[warp_conv_feat, conv_feat], dim=0), eq_flag).
What is the dimension of select_conv_feat in terms of (N,C,H,W) Inp : warp_conv_feat (1,1024,48,64) conv_feat(1,1024,48,64) After concat symbol, result dim becomes (2,1024,48,64). Now what is the output of 'select_conv_feat' symbol after going through mx.sym.take function. Iam not able to understand. Kindly help please
You can first consider the ndarray that take is operating on as a matrix (2D). If it's more than 2D, flatten it into 2D by keeping the first dim and collapsing all the rest dims into the second dim. For a 2D ndarray (matrix), take op simply extracts the rows specified by the index array and stack them one by one to form an output ndarray.
In your case, let's say eq_flag shape is (4,), then the output of the take has shape (4, 1024, 48, 64).
Thanks for the kind suggestions. I had one more query. Suppose the shape of 'eq_flag' is (1,) and the value i pass is either '0'/'1'. In this case 'mx.sym.take' will act as a switch to select either 'warp_conv_feat'/'conv_feat'? Kindly provide the suggestions and do the needful.
@reminisce any updates from your end. Pls let me know this issue.
I don't quite understand your need, but it doesn't look like the behavior you want by using take. The functionality of this op is explained in the documentation.
https://mxnet.incubator.apache.org/api/python/ndarray/ndarray.html?highlight=take#mxnet.ndarray.take
If it is not what you need, post your question here so that people can help from there. https://discuss.mxnet.io/
Proposed Labels : "Example", "Question", "NDArray"
Can you please ask usage related questions at - https://discuss.mxnet.io/ Please feel free to reopen if you encounter any issues.
What is the difference between this and NDarray.take function?