I’m not sure I understand the use case correctly, but in case you want to apply torch.cos and torch.sin on an activation you could directly do it via:
def forward(self, x): # forward method of your model
    ...
    x = self.layer(x)
    ...
    x = torch.sin(x)
    x = torch.cos(x)
    ...
    return x

or alternatively you could also create a custom nn.Module and use these operations as an “activation” function.