Symbolic programming in MXNet
Let us do some symbolic declaration:
> a <- mx.symbol.Variable("a") > a C++ object <0x11dea3e00> of class 'MXSymbol' <0x10c0a79b0> > b <- mx.symbol.Variable("b") > b C++ object <0x10fecf330> of class 'MXSymbol' <0x10c0a79b0> > c <- a + b > c C++ object <0x10f91bba0> of class 'MXSymbol' <0x10c0a79b0> >
As you can see, they are MXSymbol
objects.
We need an executor to supply data to it and to get the results:
> arg_lst <- list(symbol = c, ctx = mx.ctx.default(), a = dim(ones.matrix), + b= dim(ones.matrix), grad.req="null") > pexec <- do.call(mx.simple.bind, arg_lst) > pexec C++ object <0x11d852c40> of class 'MXExecutor' <0x101be9c30> > input_list <- list(a = ones.matrix,b = ones.matrix) > mx.exec.update.arg.arrays(pexec, input_list) > mx.exec.forward(pexec) > pexec$arg.arrays $a [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 1 1 [3...