embedding#
- ivy.embedding(weights, indices, /, *, max_norm=None, out=None)[source]#
Embeds a given tensor of indices using a given tensor of weights.
- Parameters:
weights (
Union
[Array
,NativeArray
]) – The weights tensor.indices (
Union
[Array
,NativeArray
]) – The indices tensor.max_norm (
Optional
[int
]) – The maximum norm of the embeddings. (default:None
)out (
Optional
[Array
]) – Optional output array, for writing the result to. It must have a shape that the (default:None
) inputs broadcast to.
- Return type:
- Returns:
ret – The result of the embedding operation.
Examples
>>> weights = ivy.array([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.]]) >>> indices = ivy.array([0, 2]) >>> print(ivy.embedding(weights, indices, max_norm=5)) ivy.array([[1., 2., 3.], [7., 8., 9.]])
- Array.embedding(self, indices, /, *, max_norm=None, out=None)#
- Return type:
Array
- Container.embedding(self, indices, /, *, max_norm=None, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
- Return type:
Container