# Local cost function - hybrid neural networks

**URL:** <https://discuss.pennylane.ai/t/local-cost-function-hybrid-neural-networks/1756>\
**Category:** PennyLane Help\
**Created:** [March 23, 2022, 4:55pm UTC](https://discuss.pennylane.ai/t/local-cost-function-hybrid-neural-networks/1756 "2022-03-23T16:55:22Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Muhammad\_Kashif](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/muhammad_kashif/32/558_2.png) [@Muhammad\_Kashif](https://discuss.pennylane.ai/u/Muhammad_Kashif)\
**Post date:** [March 26, 2022, 8:09am UTC](https://discuss.pennylane.ai/t/local-cost-function-hybrid-neural-networks/1756/7 "2022-03-26T08:09:47Z")

</div>

Hi @CatalinaAlbornoz,

I did add the above line you suggested but I still get the following error:

`ValueError: Input 0 of layer dense_4 is incompatible with the layer: : expected min_ndim=2, found ndim=1. Full shape received: (16,)`

**Overview of my model resulting in the above error:**  
input shape = 12 which is then passed on to 12-qubit parametrized circuit. _**Only the first qubit (q0) is measured**_ and then passed on to 10-neuron classical layer.

Looking at the error above, I thought may be measuring two qubits would resolve the issue. But in the same setting when I **measure two qubits** (q0 and q1), I get the following error:  
`ValueError: Input 0 of layer dense_5 is incompatible with the layer: expected axis -1 of input shape to have value 12 but received input with shape (16, 2)`

PS: 16 is the batch size i am using.

Thanks

---

_[View the full topic](https://discuss.pennylane.ai/t/local-cost-function-hybrid-neural-networks/1756)._
