.. _op_ai_onnx_ml_Binarizer: Binarizer ========= - **Domain**: ``ai.onnx.ml`` - **Since version**: 1 Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value. **Inputs** - **X** (*T*): Data to be binarized **Outputs** - **Y** (*T*): Binarized output data **Type Constraints** - **T**: The input must be a tensor of a numeric type. The output will be of the same tensor type. Allowed types: tensor(double), tensor(float), tensor(int32), tensor(int64). Examples -------- **test_cc_binarizer_float** .. code-block:: text Attributes: threshold = 1.0 .. code-block:: text Inputs: x: shape=(2, 4), dtype=float32 [[ 0.5, 1. , 1.5, 2. ], [-1. , 1. , 3. , 0.9]] Outputs: y: shape=(2, 4), dtype=float32 [[0., 0., 1., 1.], [0., 0., 1., 0.]] **test_cc_binarizer_int64** .. code-block:: text Attributes: threshold = 3.0 .. code-block:: text Inputs: x: shape=(5,), dtype=int64 [ 0, 3, 4, -2, 10] Outputs: y: shape=(5,), dtype=int64 [0, 0, 1, 0, 1]