Utility#

ivy.optional_get_element(x=None, /, *, out=None)[source]#

If the input is a tensor or sequence type, it returns the input. If the input is an optional type, it outputs the element in the input. It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case.

Parameters:
  • x (Optional[Array], default: None) – Input array

  • out (Optional[Array], default: None) – Optional output array, for writing the result to.

Return type:

Array

Returns:

ret – Input array if it is not None