Skip to content

Commit d7a1479

Browse files
tonybove-appleabove3
andauthored
Docs-Guides - Add Index Entries for Index (#1969)
Co-authored-by: above3 <[email protected]>
1 parent 60d1398 commit d7a1479

File tree

53 files changed

+528
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+528
-20
lines changed

docs-guides/index.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Core ML Tools
1515

1616
This guide includes instructions and examples. For details about using the API classes and methods, see the `coremltools API Reference <https://apple.github.io/coremltools/index.html>`_.
1717

18+
:ref:`genindex` | :ref:`search`
19+
1820
--------------
1921

2022
.. toctree::
@@ -79,9 +81,3 @@ This guide includes instructions and examples. For details about using the API c
7981
source/updatable-model-examples.rst
8082

8183

82-
Index
83-
-----
84-
85-
* :ref:`genindex`
86-
* :ref:`search`
87-

docs-guides/source/classifiers.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
```{eval-rst}
2+
.. index::
3+
single: classifier; preview and produce
4+
```
5+
16
# Classifiers
27

38
A [classifier](https://deepai.org/machine-learning-glossary-and-terms/classifier) is a special kind of [Core ML](https://developer.apple.com/documentation/coreml) model that provides a class label and class name to a probability dictionary as outputs. This topic describes the steps to produce a classifier model using the [Unified Conversion API](unified-conversion-api) by using the [ClassifierConfig](https://apple.github.io/coremltools/source/coremltools.converters.mil.input_types.html#classifierconfig) class.
@@ -46,6 +51,11 @@ To produce a classifier model, follow these steps:
4651
)
4752
```
4853

54+
```{eval-rst}
55+
.. index::
56+
single: PIL
57+
```
58+
4959
3. Use PIL to load and resize the image to the expected size:
5060

5161
```python
@@ -69,4 +79,8 @@ To produce a classifier model, follow these steps:
6979
All Core ML models use the Core ML framework and its APIs. However, with image input models you can also use the [Vision Classifier Observation API](https://developer.apple.com/documentation/vision/vnclassificationobservation), which provides image analysis and additional convenience features for preprocessing images.
7080
```
7181

82+
```{eval-rst}
83+
.. index::
84+
single: Vision Classifier Observation API
85+
```
7286

docs-guides/source/comparing-ml-programs-and-neural-networks.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
```{eval-rst}
2+
.. index::
3+
single: ML program; compared to neural network
4+
single: neural network; compared to ML program
5+
```
6+
7+
18
# Comparing ML Programs and Neural Networks
29

310
As ML models evolve in sophistication and complexity, their [representations](#model-representations) are also evolving to describe how they work. _ML programs_ are models that are represented as operations in code. The ML program model type is the foundation for future Core ML improvements.
@@ -12,6 +19,15 @@ A few of the major the differences between a neural network and an ML program ar
1219
| Limited control over precision | More granular control over precision |
1320

1421

22+
```{eval-rst}
23+
.. index::
24+
single: typed execution
25+
single: GPU runtime
26+
single: Metal Performance Shaders Graph framework
27+
single: compiling an ML program
28+
single: ML program; compiling
29+
```
30+
1531
## ML Program Benefits
1632

1733
Converting to an ML program provides the following advantages over converting to a neural network:
@@ -43,6 +59,10 @@ There are several ways to represent a deep learning model. At a foundational lev
4359
Three ways to represent a deep learning model.
4460
```
4561

62+
```{eval-rst}
63+
.. index:: Core ML NeuralNetwork
64+
```
65+
4666
To express a neural network, the mathematical descriptions are often abstracted into a _computational graph_, which is a more concise and scalable representation (as shown in the center of the previous figure). A computational graph is a directed graph in which computational layers connect to each other — the input feeds into the _source_ layers and undergoes a series of mathematical transformations to generate the outputs through the _sink_ layers.
4767

4868
At the center of the Core ML [NeuralNetwork](https://apple.github.io/coremltools/mlmodel/Format/NeuralNetwork.html) are the layers that form the nodes of the graph. There are many different types of layers, and each describes a particular mathematical operation. Each layer specifies its input and output names, which are the _edges_ of the graph. Connections are established by matching an output name of a layer to another layer’s input name.
@@ -91,6 +111,9 @@ While the new ML program model type supports most of the functionality supported
91111

92112
ML programs currently support both float 16 and float 32 typed weights and activations.
93113

114+
```{eval-rst}
115+
.. index:: MIL, Model Intermediate Language
116+
```
94117

95118
## ML Programs and MIL
96119

docs-guides/source/composite-operators.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
```{eval-rst}
2+
.. index::
3+
single: composite operators
4+
```
5+
16
# Composite Operators
27

38
As machine learning continually evolves, new operations are regularly added to source frameworks such as [TensorFlow](https://www.tensorflow.org/) and [PyTorch](https://pytorch.org/). While converting a model to [Core ML](https://developer.apple.com/documentation/coreml), you may encounter an unsupported operation.
@@ -42,6 +47,11 @@ You may need to first install [Transformers](https://huggingface.co/transformers
4247
![Not-implemented error](images/not-implemented-error.png)
4348

4449

50+
```{eval-rst}
51+
.. index::
52+
single: MIL operators
53+
```
54+
4555
## Decompose into Existing MIL Operators
4656

4757
The TensorFlow [documentation on Einsum](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/Einsum) refers to Einstein summation notation. You can use this notation to represent a variety of tensor operations such as `reduce_sum`, `transpose`, and `trace`, using a string. Einsum is usually a complicated operation, but with this example you don't need to know all the possible cases, just the particular notation that this model uses.

docs-guides/source/convert-a-tensorflow-1-deepspeech-model.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
```{eval-rst}
2+
.. index::
3+
single: TensorFlow 1; convert DeepSpeech model
4+
```
5+
6+
17
# Converting a TensorFlow 1 DeepSpeech Model
28

39
The following example explores the automatic handling of flexible shapes and other related capabilities of the Core ML Tools converter. It uses an [automatic speech recognition](https://en.wikipedia.org/wiki/Speech_recognition#End-to-end_automatic_speech_recognition) (ASR) task in which the input is a speech audio file and the output is the text transcription of it.

docs-guides/source/convert-a-tensorflow-1-image-classifier.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
```{eval-rst}
2+
.. index::
3+
single: TensorFlow 1; convert image classifier
4+
single: classifier; convert TensorFlow 1
5+
single: classifier; image
6+
```
7+
8+
19
# Converting a TensorFlow 1 Image Classifier
210

311
The following example converts the TensorFlow Inception V1 image classifier to a Core ML neural network classifier model that directly predicts the class label of the input image. It demonstrates the importance of setting the image preprocessing parameters correctly to get the right results.

docs-guides/source/convert-a-torchvision-model-from-pytorch.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
```{eval-rst}
2+
.. index::
3+
single: PyTorch; convert torchvision model
4+
single: torchvision model
5+
```
6+
17
# Converting a torchvision Model from PyTorch
28

39
The following example shows how to convert into Core ML a [MobileNetV2](https://pytorch.org/hub/pytorch_vision_mobilenet_v2/) model trained using PyTorch. MobileNet is a type of convolutional neural network designed for mobile and embedded vision applications.
@@ -69,6 +75,13 @@ class_labels = class_labels[1:] # remove the first class which is background
6975
assert len(class_labels) == 1000
7076
```
7177

78+
```{eval-rst}
79+
.. index::
80+
single: PyTorch; preprocess image input
81+
single: preprocessing for images
82+
```
83+
84+
7285
## Preprocess the Image Input for torchvision Models
7386

7487
Image-based models typically require the input image to be preprocessed before using it with the converted model. For the details of how to preprocess image input for torchvision models, see [Preprocessing for Torch](image-inputs.md#preprocessing-for-torch).
@@ -140,6 +153,10 @@ Right-click the following image and save it as `daisy.jpg` in the same folder as
140153
Right-click this image and save it as `daisy.jpg` in the same folder as your Python project.
141154
```
142155

156+
```{eval-rst}
157+
.. index::
158+
single: protobuf spec
159+
```
143160

144161
## Get the protobuf spec
145162

@@ -154,6 +171,11 @@ for out in spec.description.output:
154171
break
155172
```
156173

174+
```{eval-rst}
175+
.. index::
176+
single: PyTorch; make prediction
177+
```
178+
157179
## Make a Core ML Prediction
158180

159181
You can now make a prediction with the converted model, using the test image. To learn more about making predictions, see [Model Prediction](model-prediction). The code for `coreml_out_dict["classLabel"]` returns the top-level class label.
@@ -186,6 +208,7 @@ class name: vase, raw score value: 8.516773223876953
186208
class name: ant, raw score value: 8.169312477111816
187209
```
188210

211+
189212
## Make a PyTorch Prediction and Compare
190213

191214
To test the accuracy of the converted model with respect to the traced (TorchScript) model, make a prediction with the test image using the original PyTorch model.

docs-guides/source/convert-nlp-model.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Converting a Natural Language Processing Model
22

3+
```
4+
.. index::
5+
single: PyTorch; combine tracing and scripting
6+
single: PyTorch; convert natural language proocessing model
7+
```
8+
39
The following example demonstrates how you can combine [model tracing](model-tracing) and [model scripting](model-scripting) in order to properly convert a model that includes a data-dependent control flow, such as a loop or conditional.
410

511
```{warning}

docs-guides/source/convert-pytorch-workflow.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
```{eval-rst}
2+
.. index::
3+
single: PyTorch; convert workflow
4+
single: Torchscript
5+
```
6+
7+
18
# PyTorch Conversion Workflow
29

310
```{admonition} Minimum Deployment Target

docs-guides/source/convert-tensorflow-2-bert-transformer-models.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
```{eval-rst}
2+
.. index::
3+
single: TensorFlow 2; convert BERT Transformer Models
4+
```
5+
6+
17
# Converting TensorFlow 2 BERT Transformer Models
28

39
The following examples demonstrate converting TensorFlow 2 models to Core ML using Core ML Tools.

0 commit comments

Comments
 (0)