Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8461 non expressive variable name #8504

Merged
merged 9 commits into from
May 3, 2021
1 change: 1 addition & 0 deletions changelog/8461.enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change variable name from `i` to `array_2D`
4 changes: 2 additions & 2 deletions rasa/utils/tensorflow/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ def __init__(
self._layer_norm = tf.keras.layers.LayerNormalization(epsilon=1e-6)

def _get_angles(self) -> np.ndarray:
i = np.arange(self.units)[np.newaxis, :]
return 1 / np.power(10000, (2 * (i // 2)) / np.float32(self.units))
array_2D = np.arange(self.units)[np.newaxis, :]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use all lowercase: array_2d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

return 1 / np.power(10000, (2 * (array_2D // 2)) / np.float32(self.units))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use all lowercase: array_2d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


def _positional_encoding(self, max_position: tf.Tensor) -> tf.Tensor:
max_position = tf.cast(max_position, dtype=tf.float32)
Expand Down