You need to declare your parameters in the __init__, but put all computation (except for constants) in the forward pass.
You shouldn’t have to do requires_grad_ in the forward.
You should not use tensor or Tensor within your calculation. This will break the graph.
It isn’t entirely clear to me whether you want qx and qy to be learnable in some way, too (otherwise you could just write them as 0 rather than using torch.zeros. You could leave those in the __init__ if they’re constant.
class AngleModel(torch.nn.Module):
    def __init__(self):
        super(AngleModel, self).__init__()
        self.angle = nn.Parameter(torch.tensor(0.0)) # parameter will have requires_grad by default, so no need to pass in a tensor requiring grad.

    def forward(self, input):
        # make qx...qz locals
        qx = torch.zeros(1)
        qy = torch.zeros(1)
        # qw and qz are dependent on the angle, so we need to recompute them here
        qw = torch.cos(self.angle / 2.)
        qz = torch.sin(self.angle / 2.)
        # there isn't anything wrong with using torch.pow, but personally, I like **
        m11 = 1. - 2. * qy**2 - 2. * qz**2
        m22 = 1. - 2. * qx**2 - 2. * qz**2
        m33 = 1. - 2. * qx**2 - 2. * qy**2

        m21 = 2. * self.qx * self.qy - 2. * self.qz * self.qw
        m12 = 2. * self.qx * self.qy + 2. * self.qz * self.qw

        m31 = 2. * self.qx * self.qz + 2 * self.qy * self.qw
        m13 = 2. * self.qx * self.qz - 2 * self.qy * self.qw

        m32 = 2. * self.qy * self.qz - 2. * self.qx * self.qw
        m23 = 2. * self.qy * self.qz + 2. * self.qx * self.qw

        # noone uses Tensor anymore, and tensor isn't right here either, so you have to cat your way to the matrix or do something differently elsewhere
        matrix = torch.stack([
            torch.cat([m11, m21, m31], dim=0),
            torch.cat([[m12, m22, m32], dim=0),
            torch.cat([[m13, m23, m33], dim=0),
        ], dim=0)

        output = torch.matmul(input, matrix)
        return output

or something similar (I didn’t run your code because your example isn’t completely self-contained nor did I check the maths) should work.
Best regards
Thomas