gamma#

ivy.gamma(alpha, beta, /, *, shape=None, device=None, dtype=None, seed=None, out=None)[source]#

Return an array filled with random values sampled from a gamma distribution.

Parameters:
  • alpha (Union[float, NativeArray, Array]) – Alpha parameter of the gamma distribution.

  • beta (Union[float, NativeArray, Array]) – Beta parameter of the gamma distribution.

  • shape (Optional[Union[float, NativeArray, Array]], default: None) – Shape parameter of the gamma distribution.

  • device (Optional[Union[Device, NativeDevice]], default: None) – device on which to create the array. ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None).

  • dtype (Optional[Union[Dtype, NativeDtype]], default: None) – output array data type. If dtype is None, the output array data type will be the default floating point data type. Default None

  • seed (Optional[int], default: None) – A python integer. Used to create a random seed distribution

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – Returns an array filled with random values sampled from a gamma distribution.

Array.gamma(self, beta, /, *, shape=None, device=None, dtype=None, seed=None, out=None)[source]#

ivy.Array instance method variant of ivy.gamma. This method simply wraps the function, and so the docstring for ivy.gamma also applies to this method with minimal changes.

Parameters:
  • self (Array) – Input Array and the first parameter of the gamma distribution.

  • beta (Union[int, Array, NativeArray]) – The second parameter of the gamma distribution.

  • shape (Optional[Union[Shape, NativeShape]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn. (Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)

  • device (Optional[Union[Device, NativeDevice]], default: None) – device on which to create the array.

  • dtype (Optional[Union[Dtype, NativeDtype]], default: None) – output array data type. If dtype is None, the output array data type will be the default data type. Default None

  • seed (Optional[int], default: None) – A python integer. Used to create a random seed distribution

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – Drawn samples from the parameterized gamma distribution with the shape of the input array.

Container.gamma(self, beta, /, *, shape=None, device=None, dtype=None, seed=None, out=None)[source]#

ivy.Container method variant of ivy.gamma. This method simply wraps the function, and so the docstring for ivy.gamma also applies to this method with minimal changes.

Parameters:
  • self (Container) – First parameter of the distribution.

  • beta (Union[int, float, Container, Array, NativeArray]) – Second parameter of the distribution.

  • shape (Optional[Union[Shape, NativeShape, Container]], default: None) – If the given shape is, e.g ‘(m, n, k)’, then ‘m * n * k’ samples are drawn. (Default value = ‘None’, where ‘ivy.shape(logits)’ samples are drawn)

  • device (Optional[Union[str, Container]], default: None) – device on which to create the array ‘cuda:0’, ‘cuda:1’, ‘cpu’ etc. (Default value = None).

  • dtype (Optional[Union[str, Container]], default: None) – output array data type. If dtype is None, the output array data type will be the default floating-point data type. Default None

  • seed (Optional[Union[int, Container]], default: None) –

    A python integer. Used to create a random seed distribution out

    Optional output container, for writing the result to. It must have a shape that the inputs broadcast to.

Returns:

ret – Drawn samples from the parameterized gamma distribution with the shape of the input Container.