# How to add multiple inputs with MultiDataSetIterator + Computation Graph?

**URL:** <https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746>\
**Category:** DL4J\
**Created:** [July 23, 2020, 8:32pm UTC](https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746 "2020-07-23T20:32:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamcrussell](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/adamcrussell/32/259_2.png) [@adamcrussell](https://community.konduit.ai/u/adamcrussell)\
**Post date:** [July 23, 2020, 8:32pm UTC](https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746/1 "2020-07-23T20:32:33Z")

</div>

This seems like it should be simple but I haven’t seen any examples and my attempts are not working.

Suppose I have an input CSV file with 7 columns. The first six columns are ordinary numerical data but the final column is categorical. It seems the way to handle this would be something like this

```
MultiDataSetIterator mdsi = new RecordReaderMultiDataSetIterator.Builder(batchSize)
                                             .addReader("csvData", csvInputReader)
                                             .addInput("csvData", 0, 5)
                                             .addInputOneHot("csvData", 6, numClasses)
                                             .
                                             . //add reader for labels, output layer, etc
                                             .
                                             .build();

```

and then in setting up the ComputeGraph

```
ComputationGraphConfiguration cgc = new NeuralNetConfiguration.Builder()
                                                              .updater(new Sdg(1e-3))
                                                              .graphBuilder()
                                                              .addInputs("input0", "input1")
                                                              .addLayer("I0", new DenseLayer. Builder()
                                                                  .nIn(inputSize)
                                                                  .nOut(layer1Size)
                                                                  .weightInit(WeightInit.ZERO)
                                                                 .activation(Activation.SIGMOID)
                                                                 .build(), "input0")
                                                              .addLayer("I1", new DenseLayer. Builder()
                                                                  .nIn(inputSize)
                                                                  .nOut(layer1Size)
                                                                  .weightInit(WeightInit.ZERO)
                                                                 .activation(Activation.SIGMOID)
                                                                 .build(), "input1")
                                                             .addVertex("merge", new MergeVertex(), "I0", "I1")
                                                              .
                                                              .//add layers etc
                                                              .
                                                              .build();

```

Doing this will get me the error: Invalid input for layer (layer name = “I1”): input type is null

I thought I was adhering tot he closest example I could find from [https://deeplearning4j.konduit.ai/models/computationgraph](https://deeplearning4j.konduit.ai/models/computationgraph) but what is wrong with my code here?

---

<div class="post-metadata">

**Author:** ![cagneymoreau](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/cagneymoreau/32/296_2.png) [@cagneymoreau](https://community.konduit.ai/u/cagneymoreau)\
**Post date:** [July 23, 2020, 8:56pm UTC](https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746/2 "2020-07-23T20:56:31Z")

</div>

> [@adamcrussell](#):
>
> ` input type is null`

This might sound dumb but I had the same error and found that there was a comma value before my “\n” in the csv file and I didn’t notice it because it just shows up as a blank cell when visually inspecting the data in a spreadsheet.

---

<div class="post-metadata">

**Author:** ![adamcrussell](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/adamcrussell/32/259_2.png) [@adamcrussell](https://community.konduit.ai/u/adamcrussell)\
**Post date:** [July 23, 2020, 9:52pm UTC](https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746/3 "2020-07-23T21:52:31Z")

</div>

Interesting! I just checked and there is no such issue with my data file though.

---

<div class="post-metadata">

**Author:** ![adamcrussell](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/adamcrussell/32/259_2.png) [@adamcrussell](https://community.konduit.ai/u/adamcrussell)\
**Post date:** [July 23, 2020, 11:01pm UTC](https://community.konduit.ai/t/how-to-add-multiple-inputs-with-multidatasetiterator-computation-graph/746/4 "2020-07-23T23:01:26Z")

</div>

in my case it came from a line I left out of the example. the last two lines of my compute graph config looked like this

```
.setInputTypes(InputType.feedForward(batchSize))
.build();

```

Adding an additional input I had to make it look like this

```
.setInputTypes(InputType.feedForward(batchSize), InputType.feedForward(batchSize))
.build();

```

Apparently it was trying to match input types to the inputs and when it only found one it set the second to null.
