binarizer#
- ivy.binarizer(x, /, *, threshold=0, out=None)[source]#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
- Return type:
- Returns:
ret – Binarized output data
- Array.binarizer(self, /, *, threshold=0, out=None)#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
self (
Array
) – Data to be binarizedthreshold (
float
) – Values greater than this are (default:0
) mapped to 1, others to 0.out (
Optional
[Array
]) – optional output array, for writing the result to. (default:None
) It must have a shape that the inputs broadcast to.
- Return type:
Array
- Returns:
ret – Binarized output data
- Container.binarizer(self, *, threshold=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
Map the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.
- Parameters:
threshold (
float
) – Values greater than this are (default:0
) mapped to 1, others to 0.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The keychains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output container, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – Binarized output data