Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.full

Contents

jax.numpy.full#

jax.numpy.full(shape,fill_value,dtype=None,*,device=None)[source]#

Create an array full of a specified value.

JAX implementation ofnumpy.full().

Parameters:
  • shape (Any) – int or sequence of ints specifying the shape of the created array.

  • fill_value (Array |ndarray |bool |number |bool |int |float |complex |TypedNdArray) – scalar or array with which to fill the created array.

  • dtype (str |type[Any]|dtype |SupportsDType |None) – optional dtype for the created array; defaults to the dtype of thefill value.

  • device (Device |Sharding |None) – (optional)Device orShardingto which the created array will be committed.

Returns:

Array of the specified shape and dtype, on the specified device if specified.

Return type:

Array

Examples

>>>jnp.full(4,2,dtype=float)Array([2., 2., 2., 2.], dtype=float32)>>>jnp.full((2,3),0,dtype=bool)Array([[False, False, False],       [False, False, False]], dtype=bool)

fill_value may also be an array that is broadcast to the specified shape:

>>>jnp.full((2,3),fill_value=jnp.arange(3))Array([[0, 1, 2],       [0, 1, 2]], dtype=int32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp