# MXNet.jl question

**URL:** <https://discourse.julialang.org/t/mxnet-jl-question/6036>\
**Category:** General Usage\
**Created:** [September 22, 2017, 12:52pm UTC](https://discourse.julialang.org/t/mxnet-jl-question/6036 "2017-09-22T12:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [September 22, 2017, 12:52pm UTC](https://discourse.julialang.org/t/mxnet-jl-question/6036/1 "2017-09-22T12:52:41Z")

</div>

On the MXNet.jl page [https://github.com/dmlc/MXNet.jl](https://github.com/dmlc/MXNet.jl) there appears the example code

```julia
mlp = @mx.chain mx.Variable(:data) =>
  mx.FullyConnected(name=:fc1, num_hidden=128) =>
  mx.Activation(name=:relu1, act_type=:relu) =>
  mx.FullyConnected(name=:fc2, num_hidden=64) =>
  mx.Activation(name=:relu2, act_type=:relu) =>
  mx.FullyConnected(name=:fc3, num_hidden=10) =>
  mx.SoftmaxOutput(name=:softmax)

```

I have tried to pass in the number of hidden nodes for a layer as a variable, e.g., changing the above to read

```julia
MYVARIABLE = 128

mlp = @mx.chain mx.Variable(:data) =>
  mx.FullyConnected(name=:fc1, num_hidden=MYVARIABLE) =>
  mx.Activation(name=:relu1, act_type=:relu) =>
  mx.FullyConnected(name=:fc2, num_hidden=64) =>
  mx.Activation(name=:relu2, act_type=:relu) =>
  mx.FullyConnected(name=:fc3, num_hidden=10) =>
  mx.SoftmaxOutput(name=:softmax)

```

without luck. Any pointers on how to do this?

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [September 22, 2017, 7:36pm UTC](https://discourse.julialang.org/t/mxnet-jl-question/6036/2 "2017-09-22T19:36:27Z")

</div>

I’m not familiar with the package, but did you try splicing it into the expression with a “$”:

```julia
mlp = @mx.chain mx.Variable(:data) =>
  mx.FullyConnected(name=:fc1, num_hidden=$MYVARIABLE) =>
  mx.Activation(name=:relu1, act_type=:relu) =>
  mx.FullyConnected(name=:fc2, num_hidden=64) =>
  mx.Activation(name=:relu2, act_type=:relu) =>
  mx.FullyConnected(name=:fc3, num_hidden=10) =>
  mx.SoftmaxOutput(name=:softmax)

```

---

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [September 23, 2017, 2:19pm UTC](https://discourse.julialang.org/t/mxnet-jl-question/6036/3 "2017-09-23T14:19:14Z")

</div>

I tried that, no luck. What I am attempting to do used to work, but it no longer does. I’ll ask over on the MXNet.jl github page.
