Substitutes ``newname`` for ``oldname`` in the ``className`` field of custom layers. If there are no custom layers, or no layers with ``className`` = ``oldname``, then the spec is unchanged. Parameters ---------- spec: mlmodel spec oldname: str The custom layer ``
(spec, oldname, newname)
| 925 | |
| 926 | |
| 927 | def _replace_custom_layer_name(spec, oldname, newname): |
| 928 | """ |
| 929 | |
| 930 | Substitutes ``newname`` for ``oldname`` in the ``className`` field of custom layers. If there are no custom layers, or no |
| 931 | layers with ``className`` = ``oldname``, then the spec is unchanged. |
| 932 | |
| 933 | Parameters |
| 934 | ---------- |
| 935 | spec: mlmodel spec |
| 936 | |
| 937 | oldname: str |
| 938 | The custom layer ``className`` to be replaced. |
| 939 | |
| 940 | newname: str |
| 941 | The new ``className`` value to replace ``oldname``. |
| 942 | |
| 943 | Returns |
| 944 | ------- |
| 945 | An mlmodel spec. |
| 946 | |
| 947 | """ |
| 948 | layers = _get_custom_layers(spec) |
| 949 | for layer in layers: |
| 950 | if layer.custom.className == oldname: |
| 951 | layer.custom.className = newname |
| 952 | |
| 953 | |
| 954 | def _is_macos(): |