cirq.one_hot(*, index: Union[None, int, Sequence[int]] = None, shape: Union[int, Sequence[int]], value: Any = 1, dtype: Type[numpy.number]) → numpy.ndarray[source]

Returns a numpy array with all 0s and a single non-zero entry(default 1).

  • index – The index that should store the value argument instead of 0. If not specified, defaults to the start of the array.

  • shape – The shape of the array.

  • value – The hot value to place at index in the result.

  • dtype – The dtype of the array.


The created numpy array.