While the PyTorch code might run successfully, the parameters of the layer (weight and bias) will be randomly initialized in each call.
Most likely you would like to use this coding style for modules without any parameters or buffers, e.g. nn.ReLU(). However, I would then recommend to just use the functional API: output = F.relu(input).