How to create a quadratic layer and use auto_grad

Hello everyone,

I am wondering if there is a way to create a network model where the network model includes a quadratic layer. Also, I want like to take advantage of the auto_grad.
The quadratic function form is as the following: y = x^T A^T A X + p^T x + b

Any suggestions will be helpful. I really appreciate it.

Thanks,

Lening

You could create a custom nn.Module and execute the desired operation in its forward method.
The parameters and buffers (if available) can be created in the __init__. This tutorial explains it in more detail.