# TypeError while computing the gradient

**URL:** <https://discuss.pennylane.ai/t/typeerror-while-computing-the-gradient/906>\
**Category:** PennyLane Help\
**Created:** [March 10, 2021, 2:53pm UTC](https://discuss.pennylane.ai/t/typeerror-while-computing-the-gradient/906 "2021-03-10T14:53:59Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![jmarrazola](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/jmarrazola/32/255_2.png) [@jmarrazola](https://discuss.pennylane.ai/u/jmarrazola)\
**Post date:** [May 18, 2021, 6:22pm UTC](https://discuss.pennylane.ai/t/typeerror-while-computing-the-gradient/906/21 "2021-05-18T18:22:47Z")

</div>

Hi @kannan_v! Thanks for your question.

Using simulators, there are many ways to compute gradients of photonic circuits. Perhaps the most straightforward for you is to use the [StrawberryFields plugin](https://pennylane-sf.readthedocs.io/en/latest/) in PennyLane.

For hardware, it is more challenging to compute analytical gradients. The only results that I am aware of relate to the ability to compute gradients on hardware is the “WAW parametrization”, which is summarized in [this tutorial](https://strawberryfields.ai/photonics/apps/run_tutorial_training.html). It’s an idea that I believe hasn’t yet been implemented on actual hardware!

Best,

Juan Miguel

[Previous page](https://discuss.pennylane.ai/t/typeerror-while-computing-the-gradient/906.md?page=1)
