Unverified Commit 3414322d authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Handle empty weights in doc generation (#6006)

parent ddb342dd
......@@ -316,6 +316,11 @@ def inject_weight_metadata(app, what, name, obj, options, lines):
"""
if obj.__name__.endswith(("_Weights", "_QuantizedWeights")):
if len(obj) == 0:
lines[:] = ["There are no available pre-trained weights."]
return
lines[:] = [
"The model builder above accepts the following values as the ``weights`` parameter.",
f"``{obj.__name__}.DEFAULT`` is equivalent to ``{obj.DEFAULT}``.",
......
......@@ -316,6 +316,8 @@ def mnasnet0_75(*, weights: Optional[MNASNet0_75_Weights] = None, progress: bool
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.MNASNet0_75_Weights
:members:
"""
weights = MNASNet0_75_Weights.verify(weights)
......@@ -366,6 +368,8 @@ def mnasnet1_3(*, weights: Optional[MNASNet1_3_Weights] = None, progress: bool =
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.MNASNet1_3_Weights
:members:
"""
weights = MNASNet1_3_Weights.verify(weights)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment