gamma#

ivy.gamma(alpha, beta, /, *, shape, 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 (Union[float, NativeArray, Array]) – Shape parameter of the gamma distribution.

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

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

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

  • out (Optional[Array]) – optional output array, for writing the result to. It must have a shape (default: None) 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, alpha, beta, /, *, device=None, dtype=None, seed=None, out=None)#

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.

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

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

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

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

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

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

Return type:

Array

Returns:

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