Skip to content

Commit f44a0e2

Browse files
committed
Update docstrings
1 parent e4d508f commit f44a0e2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

keras_nlp/src/models/resnet/resnet_backbone.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class ResNetBackbone(FeaturePyramidBackbone):
3737
the batch normalization and ReLU activation are applied after the
3838
convolution layers.
3939
40+
Note that, `ResNetBackbone` expects the inputs to be images with a value
41+
range of `[0, 255]` when `include_rescaling=True`.
42+
4043
Args:
4144
stackwise_num_filters: list of ints. The number of filters for each
4245
stack.
@@ -77,7 +80,7 @@ class ResNetBackbone(FeaturePyramidBackbone):
7780
7881
Examples:
7982
```python
80-
input_data = np.ones((2, 224, 224, 3), dtype="float32")
83+
input_data = np.random.uniform(0, 255, size=(2, 224, 224, 3))
8184
8285
# Pretrained ResNet backbone.
8386
model = keras_nlp.models.ResNetBackbone.from_preset("resnet50")

keras_nlp/src/models/resnet/resnet_feature_pyramid_backbone.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class ResNetFeaturePyramidBackbone(ResNetBackbone):
3232
the batch normalization and ReLU activation are applied after the
3333
convolution layers.
3434
35+
Note that, `ResNetFeaturePyramidBackbone` expects the inputs to be images
36+
with a value range of `[0, 255]` when `include_rescaling=True`.
37+
3538
Args:
3639
stackwise_num_filters: list of ints. The number of filters for each
3740
stack.
@@ -44,8 +47,8 @@ class ResNetFeaturePyramidBackbone(ResNetBackbone):
4447
use_pre_activation: boolean. Whether to use pre-activation or not.
4548
`True` for ResNetV2, `False` for ResNet.
4649
include_rescaling: boolean. If `True`, rescale the input using
47-
`Rescaling(1 / 255.0)` layer. If `False`, do nothing. Defaults to
48-
`True`.
50+
`Rescaling` and `Normalization` layers. If `False`, do nothing.
51+
Defaults to `True`.
4952
input_image_shape: tuple. The input shape without the batch size.
5053
Defaults to `(None, None, 3)`.
5154
pooling: `None` or str. Pooling mode for feature extraction. Defaults
@@ -68,23 +71,23 @@ class ResNetFeaturePyramidBackbone(ResNetBackbone):
6871
`~/.keras/keras.json`. If you never set it, then it will be
6972
`"channels_last"`.
7073
dtype: `None` or str or `keras.mixed_precision.DTypePolicy`. The dtype
71-
to use for the models computations and weights.
74+
to use for the model's computations and weights.
7275
output_keys: `None` or list of strs. Keys to use for the outputs of
7376
the model. Defaults to `None`, meaning that all
7477
`self.pyramid_outputs` will be used.
7578
7679
Examples:
7780
```python
78-
input_data = np.ones((2, 224, 224, 3), dtype="float32")
81+
input_data = np.random.uniform(0, 255, size=(2, 224, 224, 3))
7982
80-
# Pretrained ResNet feature pyramid backbone.
83+
# Pretrained ResNet backbone.
8184
model = keras_nlp.models.ResNetFeaturePyramidBackbone.from_preset(
8285
"resnet50"
8386
)
8487
model(input_data)
8588
86-
# Randomly initialized ResNetV2 feature pyramidbackbone with a custom config.
87-
model = keras_nlp.models.ResNetBackbone(
89+
# Randomly initialized ResNetV2 backbone with a custom config.
90+
model = keras_nlp.models.ResNetFeaturePyramidBackbone(
8891
stackwise_num_filters=[64, 64, 64],
8992
stackwise_num_blocks=[2, 2, 2],
9093
stackwise_num_strides=[1, 2, 2],

0 commit comments

Comments
 (0)