More Operator Support
I tried resently both mxnet and google's tensor flow.
Correct me if I was wrong, because I didn't try mxnet a lot.
Mxnet seems to be faster. But tensor flow seems to be more flexible, and more nature (even more than Theano, I felt).
For example, I am still not able to add a layer to dot two mx.symbol.Variable, maybe I have to extend a Python class or even write CPP codes. But I think this is just a trivial need.
And I felt this is only one example among the others.
I don't know what is your meaning. For example, gram matrix in neural art style, we can calculate gram of convolution feature in this way
def StyleGramExecutor(input_shape, ctx):
# symbol
data = mx.sym.Variable("conv")
rs_data = mx.sym.Reshape(data=data, target_shape=(int(input_shape[1]), int(np.prod(input_shape[2:]))))
weight = mx.sym.Variable("weight")
rs_weight = mx.sym.Reshape(data=weight, target_shape=(int(input_shape[1]), int(np.prod(input_shape[2:]))))
fc = mx.sym.FullyConnected(data=rs_data, weight=rs_weight, no_bias=True, num_hidden=input_shape[1])
# executor
conv = mx.nd.zeros(input_shape, ctx=ctx)
grad = mx.nd.zeros(input_shape, ctx=ctx)
args = {"conv" : conv, "weight" : conv}
grad = {"conv" : grad}
reqs = {"conv" : "write", "weight" : "null"}
executor = fc.bind(ctx=ctx, args=args, args_grad=grad, grad_req=reqs)
return Executor(executor=executor, data=conv, data_grad=grad["conv"])
What's your expectation?
Fine, I should express myself better. Maybe I'll spend some time giving more examples. Closed For Now.
This is related to more operator support, to enable larger flexibility. MXNet was developed in an iterative matter, where operator is added when needed. You right that TF has the more operator coverage so far, but you and others can help to make mxnet better :)
The best way to improve this is open an issue for each operator needed, and we can work together to make it happen. This is not hard as imagined and it has been working for most of operators proposed c.f. #404 and other proposed ops, e.g. #215
For example, if what you asked was dot product of matrix, it is already support by FullyConnected
result = FullyConnected(A, B, no_bias=True) ;
If you would like to propose something more, open an issue like Support Dot Operator, and propose what was needed, the developers and others will give suggestions on what can be done, usually involves 10 - 100 lines of c++ code, most of which can be copied from template, and once that is added, everyone benefit from your contribution.
Thanks!
@tqchen Yeah, sure. I did realize that fully connected operator just gives the dot product of matrix. I just feel it to be a little bit 'Unnatural'. And it should be cool to make a contribution.
Yes, you are definitely right, we could also add things like mx.sym.matrix_multiplication as more low level primitive.
By the way, if I'm not wrong, for the newcomers:
result = FullyConnected(A, B, no_bias=True) ;
is not A x B but A x T(B) where T is transpose. In addition, you have to give num_hidden (required) parameter as the number of rows of B. I can add a wrapper function later unless someone else adds such a function.