Skip to content

[*.py] Rename "Arguments:" to "Args:" #323

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/generative/text_generation_with_miniature_gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class TextGenerator(keras.callbacks.Callback):
2. Predict probabilities for the next token
3. Sample the next token and add it to the next input

Arguments:
Args:
max_tokens: Integer, the number of tokens to be generated after prompt.
start_tokens: List of integers, the token indices for the starting prompt.
index_to_word: List of strings, obtained from the TextVectorization layer.
Expand Down
22 changes: 11 additions & 11 deletions examples/vision/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
def swap_xy(boxes):
"""Swaps order the of x and y coordinates of the boxes.

Arguments:
Args:
boxes: A tensor with shape `(num_boxes, 4)` representing bounding boxes.

Returns:
Expand All @@ -85,7 +85,7 @@ def swap_xy(boxes):
def convert_to_xywh(boxes):
"""Changes the box format to center, width and height.

Arguments:
Args:
boxes: A tensor of rank 2 or higher with a shape of `(..., num_boxes, 4)`
representing bounding boxes where each box is of the format
`[xmin, ymin, xmax, ymax]`.
Expand All @@ -102,7 +102,7 @@ def convert_to_xywh(boxes):
def convert_to_corners(boxes):
"""Changes the box format to corner coordinates

Arguments:
Args:
boxes: A tensor of rank 2 or higher with a shape of `(..., num_boxes, 4)`
representing bounding boxes where each box is of the format
`[x, y, width, height]`.
Expand All @@ -129,7 +129,7 @@ def convert_to_corners(boxes):
def compute_iou(boxes1, boxes2):
"""Computes pairwise IOU matrix for given two sets of boxes

Arguments:
Args:
boxes1: A tensor with shape `(N, 4)` representing bounding boxes
where each box is of the format `[x, y, width, height]`.
boxes2: A tensor with shape `(M, 4)` representing bounding boxes
Expand Down Expand Up @@ -244,7 +244,7 @@ def _compute_dims(self):
def _get_anchors(self, feature_height, feature_width, level):
"""Generates anchor boxes for a given feature map size and level

Arguments:
Args:
feature_height: An integer representing the height of the feature map.
feature_width: An integer representing the width of the feature map.
level: An integer representing the level of the feature map in the
Expand All @@ -270,7 +270,7 @@ def _get_anchors(self, feature_height, feature_width, level):
def get_anchors(self, image_height, image_width):
"""Generates anchor boxes for all the feature maps of the feature pyramid.

Arguments:
Args:
image_height: Height of the input image.
image_width: Width of the input image.

Expand Down Expand Up @@ -307,7 +307,7 @@ def get_anchors(self, image_height, image_width):
def random_flip_horizontal(image, boxes):
"""Flips image and boxes horizontally with 50% chance

Arguments:
Args:
image: A 3-D tensor of shape `(height, width, channels)` representing an
image.
boxes: A tensor with shape `(num_boxes, 4)` representing bounding boxes,
Expand Down Expand Up @@ -335,7 +335,7 @@ def resize_and_pad_image(
3. Pad with zeros on right and bottom to make the image shape divisible by
`stride`

Arguments:
Args:
image: A 3-D tensor of shape `(height, width, channels)` representing an
image.
min_side: The shorter side of the image is resized to this value, if
Expand Down Expand Up @@ -374,7 +374,7 @@ def resize_and_pad_image(
def preprocess_data(sample):
"""Applies preprocessing step to a single sample

Arguments:
Args:
sample: A dict representing a single training sample.

Returns:
Expand Down Expand Up @@ -451,7 +451,7 @@ def _match_anchor_boxes(
4. The remaining anchor boxes that do not have any class assigned are
ignored during training.

Arguments:
Args:
anchor_boxes: A float tensor with the shape `(total_anchors, 4)`
representing all the anchor boxes for a given input image shape,
where each anchor box is of the format `[x, y, width, height]`.
Expand Down Expand Up @@ -601,7 +601,7 @@ def call(self, images, training=False):
def build_head(output_filters, bias_init):
"""Builds the class/box predictions head.

Arguments:
Args:
output_filters: Number of convolution filters in the final layer.
bias_init: Bias Initializer for the final convolution layer.

Expand Down
4 changes: 2 additions & 2 deletions guides/writing_your_own_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def on_epoch_end(self, epoch, logs=None):
class EarlyStoppingAtMinLoss(keras.callbacks.Callback):
"""Stop training when the loss is at its min, i.e. the loss stops decreasing.

Arguments:
Args:
patience: Number of epochs to wait after min has been hit. After this
number of no improvement, training stops.
"""
Expand Down Expand Up @@ -347,7 +347,7 @@ def on_train_end(self, logs=None):
class CustomLearningRateScheduler(keras.callbacks.Callback):
"""Learning rate scheduler which sets the learning rate according to schedule.

Arguments:
Args:
schedule: a function that takes an epoch index
(integer, indexed from 0) and current learning rate
as inputs and returns a new learning rate as output (float).
Expand Down
2 changes: 1 addition & 1 deletion scripts/docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, project_url=None):

def process_docstring(self, docstring):
docstring = docstring.replace("Args:", "# Arguments")
docstring = docstring.replace("Arguments:", "# Arguments")
docstring = docstring.replace("Args:", "# Arguments")
Copy link
Author

Choose a reason for hiding this comment

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

Again, only accept the change on this line if keras-team/keras-contrib#550 is accepted (oh, and change to docstring.replace("Args:", "# Args"))

docstring = docstring.replace("Attributes:", "# Attributes")
docstring = docstring.replace("Returns:", "# Returns")
docstring = docstring.replace("Raises:", "# Raises")
Expand Down