<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCEmbeddingDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCEmbeddingDescriptor"
  },
  "title" : "MLCEmbeddingDescriptor"
}
-->

# MLCEmbeddingDescriptor

A configuration object you use to create an embedding layer.

```
class MLCEmbeddingDescriptor
```

## Topics

### Creating Embedding Descriptors

[`init(embeddingCount:embeddingDimension:)`](/documentation/MLCompute/MLCEmbeddingDescriptor/init(embeddingCount:embeddingDimension:))

Creates an embedding descriptor with the size of the dictionary and dimension of embedding vectors you specify.

[`init(embeddingCount:embeddingDimension:paddingIndex:maximumNorm:pNorm:scalesGradientByFrequency:)`](/documentation/MLCompute/MLCEmbeddingDescriptor/init(embeddingCount:embeddingDimension:paddingIndex:maximumNorm:pNorm:scalesGradientByFrequency:))

Creates an embedding descriptor with the size and dimension of embedding vectors, padding index, and norm and scaling options that you specify.

[`descriptorWithEmbeddingCount:embeddingDimension:`](/documentation/MLCompute/MLCEmbeddingDescriptor/descriptorWithEmbeddingCount:embeddingDimension:)

Creates an embedding descriptor with the size of the dictionary and dimension of embedding vectors you specify.

[`descriptorWithEmbeddingCount:embeddingDimension:paddingIndex:maximumNorm:pNorm:scalesGradientByFrequency:`](/documentation/MLCompute/MLCEmbeddingDescriptor/descriptorWithEmbeddingCount:embeddingDimension:paddingIndex:maximumNorm:pNorm:scalesGradientByFrequency:)

Creates a new embedding descriptor with the size and dimension of embedding vectors, padding index, and norm and scaling options that you specify.

### Inspecting Embedding Descriptors

[`embeddingCount`](/documentation/MLCompute/MLCEmbeddingDescriptor/embeddingCount-77gxz)

The size of the dictionary.

[`embeddingDimension`](/documentation/MLCompute/MLCEmbeddingDescriptor/embeddingDimension-1u9g)

The dimension of embedding vectors.

[`paddingIndex`](/documentation/MLCompute/MLCEmbeddingDescriptor/paddingIndex-pb1e)

An unsigned integer value that, if set, causes the layer to initialize the embedding vector at that index to zero.

[`maximumNorm`](/documentation/MLCompute/MLCEmbeddingDescriptor/maximumNorm-17u0k)

A float value that, if set, causes the layer to renormalize the selected embedding vectors to have an Lp norm less than this value.

[`pNorm`](/documentation/MLCompute/MLCEmbeddingDescriptor/pNorm-8vhw1)

The p of the Lp norm.

[`embeddingCount`](/documentation/MLCompute/MLCEmbeddingDescriptor/embeddingCount-5vs5t)

The size of the dictionary.

[`embeddingDimension`](/documentation/MLCompute/MLCEmbeddingDescriptor/embeddingDimension-3u8w7)

The dimension of embedding vectors.

[`paddingIndex`](/documentation/MLCompute/MLCEmbeddingDescriptor/paddingIndex-50o5o)

An unsigned integer value that, if set, causes the layer to initialize the embedding vector at that index to zero.

[`maximumNorm`](/documentation/MLCompute/MLCEmbeddingDescriptor/maximumNorm-4mrjj)

A float value that, if set, causes the layer to renormalize the selected embedding vectors to have an Lp norm less than this value.

[`pNorm`](/documentation/MLCompute/MLCEmbeddingDescriptor/pNorm-8mto8)

The p of the Lp norm.

[`scalesGradientByFrequency`](/documentation/MLCompute/MLCEmbeddingDescriptor/scalesGradientByFrequency)

A Boolean that indicates whether the layer scales gradients by the inverse of the frequency of words in batch before the weight update.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)