Type Error in QNN Algorithm

Hey! I’m working on creating a QNN model that can classify a Pneumonia dataset and I followed the demo from Pennylane (Quanvolutional Neural Networks — PennyLane documentation) … I’m currently dealing with this error. Please let me know if anyone can help resolve this issue. Thank you!


The code the TypeError is referencing

Hi @priyaltaneja

Thanks for the question :slight_smile:
According to the error message, image is receiving the wrong type of inputs. Considering the code screenshots you’ve shared, I’m not exactly certain where that is caused though, as both j and k should be integers if they are coming from range. My suspicion is that image is possibly in the incorrect format in order to be indexed in this way, but it’s hard to tell just from screenshots.

Are you able to share a non-screenshot version of your code, to make it easier to help debug? e.g., paste the entire code here in a post, or share a jupyter notebook link.