[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-24 (שעון UTC)."],[],[],null,["# NormalizeOp\n\npublic class **NormalizeOp** \n\n|---|---|---|\n| Known Direct Subclasses [DequantizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/DequantizeOp), [QuantizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/QuantizeOp) |-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| | [DequantizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/DequantizeOp) | Dequantizes a [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) with given `zeroPoint` and `scale`. | | [QuantizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/QuantizeOp) | Quantizes a [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) with given `zeroPoint` and `scale`. | |||\n\nNormalizes a [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) with given mean and stddev: output = (input - mean) / stddev. \n\n### Public Constructors\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [NormalizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/NormalizeOp#NormalizeOp(float,%20float))(float mean, float stddev) Initializes a NormalizeOp. |\n| | [NormalizeOp](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/NormalizeOp#NormalizeOp(float[],%20float[]))(float\\[\\] mean, float\\[\\] stddev) Initializes a NormalizeOp. |\n\n### Public Methods\n\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) | [apply](/edge/api/tflite/java/org/tensorflow/lite/support/common/ops/NormalizeOp#apply(org.tensorflow.lite.support.tensorbuffer.TensorBuffer))([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) input) Applies the defined normalization on given tensor and returns the result. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |\n| final [Class](https://developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.lite.support.common.TensorOperator](/edge/api/tflite/java/org/tensorflow/lite/support/common/TensorOperator) \n\n|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) | [apply](/edge/api/tflite/java/org/tensorflow/lite/support/common/TensorOperator#apply(org.tensorflow.lite.support.tensorbuffer.TensorBuffer))([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) input) |\n\nFrom interface [org.tensorflow.lite.support.common.Operator](/edge/api/tflite/java/org/tensorflow/lite/support/common/Operator) \n\n|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) | [apply](/edge/api/tflite/java/org/tensorflow/lite/support/common/Operator#apply(T))([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) x) Applies an operation on a T object, returning a T object. |\n\nPublic Constructors\n-------------------\n\n#### public\n**NormalizeOp**\n(float mean, float stddev)\n\nInitializes a NormalizeOp. When being called, it creates a new [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer), which\nsatisfies:\n\n```\n output = (input - mean) / stddev\n \n```\n\nIn the following two cases, reset `mean` to 0 and `stddev` to 1 to bypass the\nnormalization. \n\n1. Both `mean` and {code stddev} are 0. \n\n2. `mean` is 0 and {stddev} is Infinity.\n\nNote: If `mean` is set to 0 and `stddev` is set to 1, no computation will\nhappen, and original input will be directly returned in execution.\n\nNote: The returned [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) is always a [DataType.FLOAT32](/edge/api/tflite/java/org/tensorflow/lite/DataType#FLOAT32) tensor at\npresent, except when the input is a [DataType.UINT8](/edge/api/tflite/java/org/tensorflow/lite/DataType#UINT8) tensor, `mean` is set to 0 and\n`stddev` is set to 1, so that the original [DataType.UINT8](/edge/api/tflite/java/org/tensorflow/lite/DataType#UINT8) tensor is returned.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| mean | the mean value to be subtracted first. |\n| stddev | the standard deviation value to divide then. |\n|--------|----------------------------------------------|\n\n##### Throws\n\n| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if `stddev` is zero. |\n|-------------------------------------------------------------------------------------------------------------|----------------------|\n\n#### public\n**NormalizeOp**\n(float\\[\\] mean, float\\[\\] stddev)\n\nInitializes a NormalizeOp. When being called, it creates a new [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer), which\nsatisfies:\n\n```\n // Pseudo code. [...][i] means a certain element whose channel id is i.\n output[...][i] = (input[...][i] - mean[i]) / stddev[i]\n \n```\n\nNote: If all values in `mean` are set to 0 and all `stddev` are set to 1, no\ncomputation will happen, and original input will be directly returned in execution.\n\nNote: The returned [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) is always a [DataType.FLOAT32](/edge/api/tflite/java/org/tensorflow/lite/DataType#FLOAT32) tensor at\npresent, except that the input is a [DataType.UINT8](/edge/api/tflite/java/org/tensorflow/lite/DataType#UINT8) tensor, all `mean` are set to\n0 and all `stddev` are set to 1.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| mean | the mean values to be subtracted first for each channel. |\n| stddev | the standard deviation values to divide then for each channel. |\n|--------|----------------------------------------------------------------|\n\n##### Throws\n\n| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if any `stddev` is zero, or `mean` has different number of elements with `stddev`, or any of them is empty. |\n|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public [TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer)\n**apply**\n([TensorBuffer](/edge/api/tflite/java/org/tensorflow/lite/support/tensorbuffer/TensorBuffer) input)\n\nApplies the defined normalization on given tensor and returns the result.\n\nNote: `input` is possibly the same instance with the output.\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| input | input tensor. It may be the same instance with the output. |\n|-------|------------------------------------------------------------|\n\n##### Returns\n\n- output tensor."]]