Basic i/o question about `attr in node`


Using JuliaLang, which is new to me. New to MXNet and DL/RL as well.

My network setup is a simple 2 hidden layer FeedForward MLP. Input size is (3,3,3,1). Output size is (27,1):

navNet = @mx.chain mx.Variable(:navData) => mx.FullyConnected(name=:navFc1, num_hidden = 100) => mx.Activation(name=:navRelu1, act_type=:relu) => mx.FullyConnected(name=:navFc2, num_hidden = 100) => mx.Activation(name=:navRelu2, act_type=:relu) => mx.FullyConnected(name=:navFc3, num_hidden = 27) => mx.LinearRegressionOutput(name=:navLinRegressOut1) navInit = mx.XavierInitializer() navModel = mx.FeedForward(navNet,context=mx.cpu()) mx.init_model(navModel,navInit; overwrite=false,navData=(3,3,3,1),navLinRegressOut1_label=(27,1))

Performing prediction with ArrayDataProvider:
function predictPomdpStep(nav::Navigator,cellObjects) mx.reshape(cellObjects,(3,3,3)) cellsIter = mx.ArrayDataProvider(:navData => cellObjects; batch_size = 0, shuffle=false) mx.predict(nav.neuralParams.navModel,cellsIter) end

Receiving the following error:
Incompatiable attr in node at 0-th output: expected (100,27), got (100,9)

Why is output expecting size (100,27). I set my input size to (3,3,3,1), which I believe means tensor size (3,3,3) batch size 1. Also, why is output (100,9)? The last layer has 27 outputs.

Direct answers as well as links to similar questions are very helpful. I’m sure that this is a common problem, but I inexplicably can’t find any examples of MXNet reinforcement learning using the FeedForward.predict() function in this way.

Edit: formatting… still terrible tho


Hi @han-so1omon, try ``` above and below for formatting code blocks.

I’m new to Julia, but your architecture looks reasonable, and I agree with your expected shapes for input (3,3,3,1) and output (27,1). But I have 2 questions. Why are you reshaping in predictPomdpStep and not including batch size dimension and using batch size of 0? And why are you using instead of Do you get the same issue if you follow the steps in this tutorial?