I have a Python class with methods that include docstrings. When I hover over the method names in my IDE (I'm using PyCharm), the docstring content appears twice. Here's an example of one of my methods:
import numpy as np
class ReLu:
"""
ReLu (Rectified Linear Unit) activation function for neural networks.
"""
def forward_train(self, z: np.array) -> np.array:
"""
Perform the forward pass during training and store the input for use in backpropagation.
Args:
z (np.array): The input data to the activation function.
Returns:
np.array: The result of applying the ReLU function to the input data.
"""
self.__z = z
return self.forward(z)
Problem: When I hover over the forward_train method in PyCharm, I see the text twice, like this:
Perform the forward pass during training and store the input for use in backpropagation.
Args: z (np. array): The input data to the activation function. Returns: np. array: The result of applying the ReLU function to the input data.
Params:
z – The input data to the activation function.
Returns:
The result of applying the ReLU function to the input data.
It looks like the IDE is displaying my docstring twice, formatted differently. I want to know how to avoid this duplication or what might be causing it.