Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
e2a31b15
Commit
e2a31b15
authored
Dec 23, 2020
by
A. Unique TensorFlower
Browse files
Merge pull request #9575 from SamuelMarks:args-for-google-style-docstrings-official
PiperOrigin-RevId: 348853056
parents
584b5f29
90979a21
Changes
50
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
16 deletions
+16
-16
official/nlp/modeling/networks/xlnet_base.py
official/nlp/modeling/networks/xlnet_base.py
+2
-2
official/nlp/projects/bigbird/encoder.py
official/nlp/projects/bigbird/encoder.py
+1
-1
official/nlp/xlnet/xlnet_modeling.py
official/nlp/xlnet/xlnet_modeling.py
+1
-1
official/staging/training/grad_utils.py
official/staging/training/grad_utils.py
+2
-2
official/vision/beta/losses/retinanet_losses.py
official/vision/beta/losses/retinanet_losses.py
+4
-4
official/vision/detection/executor/distributed_executor.py
official/vision/detection/executor/distributed_executor.py
+1
-1
official/vision/keras_cv/layers/deeplab.py
official/vision/keras_cv/layers/deeplab.py
+1
-1
official/vision/keras_cv/losses/focal_loss.py
official/vision/keras_cv/losses/focal_loss.py
+2
-2
official/vision/keras_cv/losses/loss_utils.py
official/vision/keras_cv/losses/loss_utils.py
+1
-1
official/vision/keras_cv/metrics/iou.py
official/vision/keras_cv/metrics/iou.py
+1
-1
No files found.
official/nlp/modeling/networks/xlnet_base.py
View file @
e2a31b15
...
@@ -52,7 +52,7 @@ def _create_causal_attention_mask(
...
@@ -52,7 +52,7 @@ def _create_causal_attention_mask(
We then flip the matrix values in order to match the representation where
We then flip the matrix values in order to match the representation where
real values are 1s.
real values are 1s.
Arg
ument
s:
Args:
seq_length: int, The length of each sequence.
seq_length: int, The length of each sequence.
memory_length: int, The length of memory blocks.
memory_length: int, The length of memory blocks.
dtype: dtype of the mask.
dtype: dtype of the mask.
...
@@ -392,7 +392,7 @@ class RelativePositionEncoding(tf.keras.layers.Layer):
...
@@ -392,7 +392,7 @@ class RelativePositionEncoding(tf.keras.layers.Layer):
def
call
(
self
,
pos_seq
,
batch_size
=
None
):
def
call
(
self
,
pos_seq
,
batch_size
=
None
):
"""Implements call() for the layer.
"""Implements call() for the layer.
Arg
ument
s:
Args:
pos_seq: A 1-D `Tensor`
pos_seq: A 1-D `Tensor`
batch_size: The optionally provided batch size that tiles the relative
batch_size: The optionally provided batch size that tiles the relative
positional encoding.
positional encoding.
...
...
official/nlp/projects/bigbird/encoder.py
View file @
e2a31b15
...
@@ -30,7 +30,7 @@ class BigBirdEncoder(tf.keras.Model):
...
@@ -30,7 +30,7 @@ class BigBirdEncoder(tf.keras.Model):
*Note* that the network is constructed by
*Note* that the network is constructed by
[Keras Functional API](https://keras.io/guides/functional_api/).
[Keras Functional API](https://keras.io/guides/functional_api/).
Arg
ument
s:
Args:
vocab_size: The size of the token vocabulary.
vocab_size: The size of the token vocabulary.
hidden_size: The size of the transformer hidden layers.
hidden_size: The size of the transformer hidden layers.
num_layers: The number of transformer layers.
num_layers: The number of transformer layers.
...
...
official/nlp/xlnet/xlnet_modeling.py
View file @
e2a31b15
...
@@ -114,7 +114,7 @@ class RelativePositionEncoding(tf.keras.layers.Layer):
...
@@ -114,7 +114,7 @@ class RelativePositionEncoding(tf.keras.layers.Layer):
def
call
(
self
,
pos_seq
,
batch_size
=
None
):
def
call
(
self
,
pos_seq
,
batch_size
=
None
):
"""Implements call() for the layer.
"""Implements call() for the layer.
Arg
ument
s:
Args:
pos_seq: A 1-D `Tensor`
pos_seq: A 1-D `Tensor`
batch_size: The optionally provided batch size that tiles the relative
batch_size: The optionally provided batch size that tiles the relative
positional encoding.
positional encoding.
...
...
official/staging/training/grad_utils.py
View file @
e2a31b15
...
@@ -57,7 +57,7 @@ def _filter_and_allreduce_gradients(grads_and_vars,
...
@@ -57,7 +57,7 @@ def _filter_and_allreduce_gradients(grads_and_vars,
The allreduced gradients are then passed to optimizer.apply_gradients(
The allreduced gradients are then passed to optimizer.apply_gradients(
experimental_aggregate_gradients=False).
experimental_aggregate_gradients=False).
Arg
ument
s:
Args:
grads_and_vars: gradients and variables pairs.
grads_and_vars: gradients and variables pairs.
allreduce_precision: Whether to allreduce gradients in float32 or float16.
allreduce_precision: Whether to allreduce gradients in float32 or float16.
bytes_per_pack: A non-negative integer. Breaks collective operations into
bytes_per_pack: A non-negative integer. Breaks collective operations into
...
@@ -101,7 +101,7 @@ def minimize_using_explicit_allreduce(tape,
...
@@ -101,7 +101,7 @@ def minimize_using_explicit_allreduce(tape,
For TPU and GPU training using FP32, explicit allreduce will aggregate
For TPU and GPU training using FP32, explicit allreduce will aggregate
gradients in FP32 format.
gradients in FP32 format.
Arg
ument
s:
Args:
tape: An instance of `tf.GradientTape`.
tape: An instance of `tf.GradientTape`.
optimizer: An instance of `tf.keras.optimizers.Optimizer`.
optimizer: An instance of `tf.keras.optimizers.Optimizer`.
loss: the loss tensor.
loss: the loss tensor.
...
...
official/vision/beta/losses/retinanet_losses.py
View file @
e2a31b15
...
@@ -68,7 +68,7 @@ class FocalLoss(tf.keras.losses.Loss):
...
@@ -68,7 +68,7 @@ class FocalLoss(tf.keras.losses.Loss):
name
=
None
):
name
=
None
):
"""Initializes `FocalLoss`.
"""Initializes `FocalLoss`.
Arg
ument
s:
Args:
alpha: The `alpha` weight factor for binary class imbalance.
alpha: The `alpha` weight factor for binary class imbalance.
gamma: The `gamma` focusing parameter to re-weight loss.
gamma: The `gamma` focusing parameter to re-weight loss.
num_classes: Number of foreground classes.
num_classes: Number of foreground classes.
...
@@ -91,7 +91,7 @@ class FocalLoss(tf.keras.losses.Loss):
...
@@ -91,7 +91,7 @@ class FocalLoss(tf.keras.losses.Loss):
def
call
(
self
,
y_true
,
y_pred
):
def
call
(
self
,
y_true
,
y_pred
):
"""Invokes the `FocalLoss`.
"""Invokes the `FocalLoss`.
Arg
ument
s:
Args:
y_true: Ordered Dict with level to [batch, height, width, num_anchors].
y_true: Ordered Dict with level to [batch, height, width, num_anchors].
for example,
for example,
{3: tf.Tensor(shape=[32, 512, 512, 9], dtype=tf.float32),
{3: tf.Tensor(shape=[32, 512, 512, 9], dtype=tf.float32),
...
@@ -143,7 +143,7 @@ class RetinanetBoxLoss(tf.keras.losses.Loss):
...
@@ -143,7 +143,7 @@ class RetinanetBoxLoss(tf.keras.losses.Loss):
name
=
None
):
name
=
None
):
"""Initializes `RetinanetBoxLoss`.
"""Initializes `RetinanetBoxLoss`.
Arg
ument
s:
Args:
delta: A float, the point where the Huber loss function changes from a
delta: A float, the point where the Huber loss function changes from a
quadratic to linear.
quadratic to linear.
reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
...
@@ -167,7 +167,7 @@ class RetinanetBoxLoss(tf.keras.losses.Loss):
...
@@ -167,7 +167,7 @@ class RetinanetBoxLoss(tf.keras.losses.Loss):
Computes total detection loss including box and class loss from all levels.
Computes total detection loss including box and class loss from all levels.
Arg
ument
s:
Args:
y_true: Ordered Dict with level to [batch, height, width,
y_true: Ordered Dict with level to [batch, height, width,
num_anchors * 4] for example,
num_anchors * 4] for example,
{3: tf.Tensor(shape=[32, 512, 512, 9 * 4], dtype=tf.float32),
{3: tf.Tensor(shape=[32, 512, 512, 9 * 4], dtype=tf.float32),
...
...
official/vision/detection/executor/distributed_executor.py
View file @
e2a31b15
...
@@ -108,7 +108,7 @@ class SummaryWriter(object):
...
@@ -108,7 +108,7 @@ class SummaryWriter(object):
def
__init__
(
self
,
model_dir
:
Text
,
name
:
Text
):
def
__init__
(
self
,
model_dir
:
Text
,
name
:
Text
):
"""Inits SummaryWriter with paths.
"""Inits SummaryWriter with paths.
Arg
ument
s:
Args:
model_dir: the model folder path.
model_dir: the model folder path.
name: the summary subfolder name.
name: the summary subfolder name.
"""
"""
...
...
official/vision/keras_cv/layers/deeplab.py
View file @
e2a31b15
...
@@ -42,7 +42,7 @@ class SpatialPyramidPooling(tf.keras.layers.Layer):
...
@@ -42,7 +42,7 @@ class SpatialPyramidPooling(tf.keras.layers.Layer):
**
kwargs
):
**
kwargs
):
"""Initializes `SpatialPyramidPooling`.
"""Initializes `SpatialPyramidPooling`.
Arg
ument
s:
Args:
output_channels: Number of channels produced by SpatialPyramidPooling.
output_channels: Number of channels produced by SpatialPyramidPooling.
dilation_rates: A list of integers for parallel dilated conv.
dilation_rates: A list of integers for parallel dilated conv.
pool_kernel_size: A list of integers or None. If None, global average
pool_kernel_size: A list of integers or None. If None, global average
...
...
official/vision/keras_cv/losses/focal_loss.py
View file @
e2a31b15
...
@@ -31,7 +31,7 @@ class FocalLoss(tf.keras.losses.Loss):
...
@@ -31,7 +31,7 @@ class FocalLoss(tf.keras.losses.Loss):
name
=
None
):
name
=
None
):
"""Initializes `FocalLoss`.
"""Initializes `FocalLoss`.
Arg
ument
s:
Args:
alpha: The `alpha` weight factor for binary class imbalance.
alpha: The `alpha` weight factor for binary class imbalance.
gamma: The `gamma` focusing parameter to re-weight loss.
gamma: The `gamma` focusing parameter to re-weight loss.
reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
...
@@ -52,7 +52,7 @@ class FocalLoss(tf.keras.losses.Loss):
...
@@ -52,7 +52,7 @@ class FocalLoss(tf.keras.losses.Loss):
def
call
(
self
,
y_true
,
y_pred
):
def
call
(
self
,
y_true
,
y_pred
):
"""Invokes the `FocalLoss`.
"""Invokes the `FocalLoss`.
Arg
ument
s:
Args:
y_true: A tensor of size [batch, num_anchors, num_classes]
y_true: A tensor of size [batch, num_anchors, num_classes]
y_pred: A tensor of size [batch, num_anchors, num_classes]
y_pred: A tensor of size [batch, num_anchors, num_classes]
...
...
official/vision/keras_cv/losses/loss_utils.py
View file @
e2a31b15
...
@@ -20,7 +20,7 @@ import tensorflow as tf
...
@@ -20,7 +20,7 @@ import tensorflow as tf
def
multi_level_flatten
(
multi_level_inputs
,
last_dim
=
None
):
def
multi_level_flatten
(
multi_level_inputs
,
last_dim
=
None
):
"""Flattens a multi-level input.
"""Flattens a multi-level input.
Arg
ument
s:
Args:
multi_level_inputs: Ordered Dict with level to [batch, d1, ..., dm].
multi_level_inputs: Ordered Dict with level to [batch, d1, ..., dm].
last_dim: Whether the output should be [batch_size, None], or [batch_size,
last_dim: Whether the output should be [batch_size, None], or [batch_size,
None, last_dim]. Defaults to `None`.
None, last_dim]. Defaults to `None`.
...
...
official/vision/keras_cv/metrics/iou.py
View file @
e2a31b15
...
@@ -48,7 +48,7 @@ class PerClassIoU(tf.keras.metrics.Metric):
...
@@ -48,7 +48,7 @@ class PerClassIoU(tf.keras.metrics.Metric):
def
__init__
(
self
,
num_classes
,
name
=
None
,
dtype
=
None
):
def
__init__
(
self
,
num_classes
,
name
=
None
,
dtype
=
None
):
"""Initializes `PerClassIoU`.
"""Initializes `PerClassIoU`.
Arg
ument
s:
Args:
num_classes: The possible number of labels the prediction task can have.
num_classes: The possible number of labels the prediction task can have.
This value must be provided, since a confusion matrix of dimension =
This value must be provided, since a confusion matrix of dimension =
[num_classes, num_classes] will be allocated.
[num_classes, num_classes] will be allocated.
...
...
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment