2024-05-07 æçµæ´æ°æ¥ 2024-05-26 éååï¼è«æ Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference ãèªãï¼ï¼ï¼ AI AI-éåå ãéååã®è«æãèªããã®2åç®ã§ãï¼ Googleã2017å¹´12æã«arXivã«ç»é²ããè«æã®ãQuantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inferenceãã®ç¶ãã§ãä»åã¯2ç« ãèªãã§ããã¾ãã ã¯ããã« åèãµã¤ã 2. Quantized Inference 2.1. Quantization scheme 2.2. Integerarithmeticonly matrix multiplication 2.3. Efficient handling of zeropoints 2.4. Implementation of a typical fused layer ãããã« ã¯ããã« éååã®è¨äºä¸è¦§ã§ããè¯ãã£ããåèã«ãã¦ãã ããã éååã®è¨äºä¸è¦§ ã»è«æ Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference ãèªãï¼ï¼ï¼ ã»è«æ Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference ãèªãï¼ï¼ï¼ â ä»å ã»TensorFlow Lite Python ã§éååã¢ãã«ãRaspberry Pi 4ã§åãã ã»TensorFlow Lite C++ ã§éååã¢ãã«ãRaspberry Pi 4ã§åãã ã»Raspberry Pi 4 ã® TensorFlow Lite C++ ã VSCode ã§ãªã¢ã¼ããããã°ãã ã»gemmlowpã©ã¤ãã©ãªã®ã½ã¼ã¹ã³ã¼ããèªãã§éååãå¦ã¶ï¼ãµã³ãã«ã½ã¼ã¹ã®å®è¡ï¼ ã»gemmlowpã©ã¤ãã©ãªã®ã½ã¼ã¹ã³ã¼ãããããã¬ã使ã£ã¦ç解ãã åèãµã¤ã arxiv.org 2. Quantized Inference 2.1. Quantization scheme ä»åãããã¹ã¦ChatGPTã«ä¸¸æã翻訳ã§ãï¼ç¬ï¼ ãã®ã»ã¯ã·ã§ã³ã§ã¯ãä¸è¬çãªéååã¹ãã¼ã ã«ã¤ãã¦èª¬æãã¾ããããªãã¡ãå¤ã®ããã表ç¾ï¼ä»¥ä¸ã"" ã¨è¡¨è¨ãã"éååãããå¤"ã®æå³ï¼ã¨æ°å¦çå®æ°å¤ã®è§£éï¼ä»¥ä¸ã"" ã¨è¡¨è¨ãã"å®æ°å¤"ã®æå³ï¼ã®å¯¾å¿é¢ä¿ã«ã¤ãã¦èª¬æãã¾ããç§ãã¡ã®éååã¹ãã¼ã ã¯ãæ¨è«ä¸ã«æ´æ°ã®ã¿ã®ç®è¡ã使ç¨ãããã¬ã¼ãã³ã°ä¸ã«ã¯æµ®åå°æ°ç¹ã®ç®è¡ã使ç¨ãã¦å®è£ ããã¾ãã両æ¹ã®å®è£ ã¯äºãã«é«ã対å¿æ§ãç¶æãã¦ãã¾ããããã¯ãã¾ãæã ã®éååã¹ãã¼ã ã®æ°å¦çã«å³å¯ãªå®ç¾©ãæä¾ããããã¦æ´æ°æ¼ç®æ¨è«ã¨æµ®åå°æ°ç¹ãã¬ã¼ãã³ã°ã®ä¸¡æ¹ã§ãã®ã¹ãã¼ã ãåå¥ã«æ¡ç¨ãããã¨ã«ãã£ã¦éæããã¾ãã éè¦ãªãã¨ã¯ãå¦ç¿ä¸ã¯ãã©ã¯ã¼ãå¦çãæµ®åå°æ°ç¹æ°ã使ç¨ãã¦ããã¨ãããã¨ã§ãããä¸æ¹ãæ¨è«æã¯æ´æ°ã®ã¿ã§æ¼ç®ããã¾ãã ç§ãã¡ã®éååã¹ãã¼ã ã®åºæ¬çãªè¦ä»¶ã¯ãéååãããå¤ã«å¯¾ãã¦æ´æ°æ¼ç®æä½ã®ã¿ã使ç¨ãã¦ãã¹ã¦ã®ç®è¡ãå¹ççã«å®è£ ã§ãããã¨ã§ãï¼SIMDãã¼ãã¦ã§ã¢ä¸ã®ç´ç²ãªç®è¡ã¨æ¯è¼ãã¦ã«ãã¯ã¢ãããã¼ãã«ãå¿ è¦ã¨ããå®è£ ã¯æ§è½ãä½ãå¾åããããããããããé¿ãã¾ãï¼ãããã¯ãéååã¹ãã¼ã ãæ´æ° ããå®æ° ã¸ã®ã¢ãã£ã³ãããã³ã°ã§ãããã¨ãè¦æ±ãããã¨ã¨åçã§ãããããªãã¡ä»¥ä¸ã®å½¢å¼ã§ãããã¨ãè¦æ±ãã¾ãã ãããç§ãã¡ã®éååã¹ãã¼ã ã§ãããå®æ° 㨠ãç§ãã¡ã®éååãã©ã¡ã¼ã¿ã§ããç§ãã¡ã®éååã¹ãã¼ã ã¯ãåã¢ã¯ãã£ãã¼ã·ã§ã³é åå ã®ãã¹ã¦ã®å¤ã¨åéã¿é åå ã®ãã¹ã¦ã®å¤ã«å¯¾ãã¦1ã¤ã®ã»ããã®éååãã©ã¡ã¼ã¿ã使ç¨ããå¥ã ã®é åã«ã¯å¥ã ã®éååãã©ã¡ã¼ã¿ã使ç¨ãã¾ãã ã¢ãã£ã³ãããã³ã°ã¨ã¯ãç·å½¢å¤æã®ä¸ç¨®ã§ãå ã®ç©ºéå ã®ç¹ããå¥ã®ç©ºéå ã®ç¹ã«å¯¾å¿ä»ããæä½ã§ãï¼from ChatGPTï¼ã éååæä½ã¯ãç°¡åãªä¸æ¬¡å¼ã®å¤æã使ãã¨ãããã¨ã§ããã 8ãããã®éååã§ã¯ã ã¯8ãããã®æ´æ°ã¨ãã¦éååããã¾ãï¼ ãããã®éååã§ã¯ã 㯠ãããã®æ´æ°ã¨ãã¦éååããã¾ãï¼ãããã¤ãã®é åãé常ã¯ãã¤ã¢ã¹ãã¯ãã«ãªã©ã¯32ãããã®æ´æ°ã¨ãã¦éååããã¾ãã詳細ã¯ã»ã¯ã·ã§ã³2.4ãåç §ãã¦ãã ããã å®æ° ï¼ã¹ã±ã¼ã«ï¼ã¯ä»»æã®æ£ã®å®æ°ã§ããããã¯ãé常ãå®æ°å¤ ã¨åæ§ã«ãã½ããã¦ã§ã¢ä¸ã§æµ®åå°æ°ç¹ã®æ°éã¨ãã¦è¡¨ããã¾ããã»ã¯ã·ã§ã³2.2ã§ã¯ãæ¨è«ã¯ã¼ã¯ãã¼ãã§ã®æµ®åå°æ°ç¹æ°éã®è¡¨ç¾ãåé¿ããæ¹æ³ã«ã¤ãã¦èª¬æãã¦ãã¾ãã å®æ° ï¼ã¼ããã¤ã³ãï¼ã¯ãéååãããå¤ ã¨åãåã§ãããå®éã«ã¯å®æ°å¤ ã«å¯¾å¿ããéååãããå¤ ã§ããããã«ãããå®æ°å¤ ãéååãããå¤ã§æ£ç¢ºã«è¡¨ç¾ã§ããããã«ãªãã¾ãããã®è¦ä»¶ã®åæ©ã¯ããã¥ã¼ã©ã«ãããã¯ã¼ã¯æ¼ç®åã®å¹ççãªå®è£ ã«ã¯ããã°ãã°é åã®å¢çå¨ãã«ã¼ãããã£ã³ã°ãå¿ è¦ã§ãããã¨ã§ãã ããã¾ã§ã®è°è«ã¯ã次ã®ãããªéååããããããã¡ãã¼ã¿æ§é ã§è¦ç´ããã¾ãããã®ãããªãããã¡ã®1ã¤ã®ã¤ã³ã¹ã¿ã³ã¹ããã¥ã¼ã©ã«ãããã¯ã¼ã¯å ã®åã¢ã¯ãã£ãã¼ã·ã§ã³é åã¨éã¿é åã«åå¨ãã¾ããåã®æ確ãªä¼éãå¯è½ã«ããããã«ãC++æ§æã使ç¨ãã¦ãã¾ãã template<typename QType> // e.g. QType=uint8 struct QuantizedBuffer { vector<QType> q; // the quantized values float S; // the scale QType Z; // the zero-point }; å¼ ã®å®ç¾©ã説æããã¦ãã¾ãã éè¦ãªã¨ããã¯ãéåå空éã®ã¼ããã¤ã³ãã¯ããªã¢ã«ç©ºéã® ã«å¯¾å¿ããã¨ããã¨ããã§ãã éååã¯ããªã¢ã«ç©ºéã®ãã¹ã¦ã®å¤ãéåå空éã§ã¯è¡¨ç¾ã§ãã¾ãããä¾ãã°ããªã¢ã«ç©ºéã§é常ã«è¿ãå¤ã®2ã¤ã®å¤ã¯ãéåå空éã§ã¯åãå¤ã¨ãã¦è¡¨ç¾ãããå¯è½æ§ãé«ãã§ãã éååã«ãããæ å ±ãå°ãªããã¦ãã以ä¸ãä»æ¹ãªããã¨ã§ããããªã¢ã«ç©ºéã® ã¯ãããã£ã³ã°ãªã©ã§å¤ç¨ãããããç¹å¥éè¦ã ãããéåå空éã§æ£ç¢ºã«è¡¨ç¾ã§ããããã«ãã¦ããã¨ãããã¨ã§ãã ããããã®èæ ®ãããªãå ´åããªã¢ã«ç©ºéã® ã¯ãéåå空éãããªã¢ã«ç©ºéã«æ»ããã¨ãã«ãå¾®å¦ã« ã§ã¯ãªãå¤ã«ãªã£ã¦ãã¾ãã¾ãã 以ä¸ã2.1ç« ã§ããã 2.2. Integerarithmeticonly matrix multiplication ãã¦ãæ´æ°æ¼ç®ã®ã¿ã使ç¨ãã¦æ¨è«ãè¡ãæ¹æ³ã«ã¤ãã¦èãã¦ã¿ã¾ããããã¤ã¾ããå®æ°å¤ã®è¨ç®ãéååãããå¤ã®è¨ç®ã«å¤æããããã«æ¹ç¨å¼ ãã©ã®ããã«ä½¿ç¨ããå¾è ãã©ã®ããã«è¨è¨ãã¦ã尺度ã®å¤ ãæ´æ°ã§ãªãã¦ãæ´æ°æ¼ç®ã®ã¿ãå«ãããã«ã¤ãã¦ã§ãã å®æ° 㨠ï¼ãã®ç©ã¯ ã§è¡¨ãããï¼ã® æ£æ¹è¡åã®ä¹ç®ãèãã¾ãããããã®è¡åã®ããããã®ã¨ã³ããªã¯ ã§ãï¼ãã ããï¼ã¨ç¤ºãã¾ããããããéååãããéååãã©ã¡ã¼ã¿ã¯ã ã¨ç¤ºãã¾ããéååãããã¨ã³ããªã¯ ã¨ãã¾ãã ããã¨ãæ¹ç¨å¼ ã¯æ¬¡ã®ããã«ãªãã¾ãï¼ è¡åã®ä¹ç®ã®å®ç¾©ããã次ã®ããã«ãªãã¾ãï¼ ããã¯æ¬¡ã®ããã«æ¸ãæãããã¾ãï¼ ããã§ãä¹æ° ã¯æ¬¡ã®ããã«å®ç¾©ããã¾ãï¼ æ¹ç¨å¼ ã§ã¯ãå¯ä¸ã®éæ´æ°ã¯ä¹æ° ã§ããããã¯ãéåå尺度 ã«ã®ã¿ä¾åããå®æ°ã§ããããªãã©ã¤ã³ã§è¨ç®ã§ãã¾ããæã ã¯å®é¨çã«ã常ã«åºé ã«ãããã¨ãããã£ã¦ããããããã£ã¦æ£è¦åãããå½¢å¼ã§è¡¨ããã¨ãã§ãã¾ãï¼ ããã§ã ã¯åºé ã«ããã ã¯éè² ã®æ´æ°ã§ããæ£è¦åãããä¹æ° ã¯ãåºå®å°æ°ç¹ä¹æ°ï¼ãã¼ãã¦ã§ã¢ã®è½åã«å¿ãã¦int16ã¾ãã¯int32ãªã©ï¼ã¨ãã¦ãã¾ã表ç¾ã§ãã¾ãããã¨ãã°ãint32ã使ç¨ãããå ´åã ã表ãæ´æ°ã¯ã ã«æãè¿ãint32å¤ã§ãã ã§ããããããã®å¤ã¯å¸¸ã«å°ãªãã¨ã ã§ããããããã£ã¦å°ãªãã¨ã30ãããã®ç¸å¯¾ç²¾åº¦ãæã¡ã¾ãããããã£ã¦ã ã«ããä¹ç®ã¯åºå®å°æ°ç¹ä¹ç®ã¨ãã¦å®è£ ã§ãã¾ããä¸æ¹ã ã«ããä¹ç®ã¯å¹ççãªãããã·ããã§å®è£ ã§ãã¾ãããããã¯æ£ç¢ºãªæãè¿ã丸ãåä½ãæã¤å¿ è¦ãããã¾ãããã®åé¡ã«ã¤ãã¦ã¯ãä»é²Bã§åãä¸ãã¾ãã ååã¯ã è¡åã® ï¼ã®1è¡ç®ï¼ã¨ ï¼ã®1åç®ï¼ãç©åãã¦ã ã®å·¦ä¸ã®1è¦ç´ åã®è¨ç®éç¨ã示ãã¦ãã¾ãã éååä¿æ° ã ã«ã¾ã¨ãã¦ãå¾å㯠ã®èª¬æã§ãã ããã¯è«æãèªãã ãã§ã¯ç解ã§ããªãã£ãã®ã§ãgemmlowp ã®å®è£ ã確èªãã¾ãããè¯ãã£ãã以ä¸ãåèã«ãã¦ãã ããã daisuke20240310.hatenablog.com ç°¡åã«è¨ãã¨ãint32 ã®å ´åã¯ã31bit ã®åºå®å°æ°ç¹æ¼ç®ãè¡ããã¨ã§ãæµ®åå°æ°ç¹æ¼ç®ããå ´åã¨æ¯ã¹ã¦ããªãã¹ã誤差ãåºããªãããã«ããã¨ãããã¨ã§ãã 2.3. Efficient handling of zeropoints æ¹ç¨å¼ ã®è©ä¾¡ãå¹ççã«å®è£ ããããã«ã åã®æ¸ç®ãè¡ãå¿ è¦ããªããä¹ç®ã®ãªãã©ã³ãã16ãããæ´æ°ã«å±éããå¿ è¦ããªãããããã«ã¯ãã¾ãæ¹ç¨å¼ ã®ä¹ç®ãåé ãããã¨ã«ãã£ã¦ãããã次ã®ããã«æ¸ãç´ããã¨ãã§ãããã¨ã«æ°ä»ãã¾ãï¼ ããã§ã åã ã® ã¾ã㯠ãè¨ç®ããã«ã¯ åã®å ç®ãå¿ è¦ã§ããããããã£ã¦åè¨ã§ åã®å ç®ããå¿ è¦ããã¾ãããæ¹ç¨å¼ ã®è©ä¾¡ã®æ®ãã®ã³ã¹ãã¯ãã»ã¨ãã©ã次ã®æ´æ°è¡åã®ä¹ç®èç©ã«éä¸ãã¦ãã¾ãï¼ ãã®é¨å㯠ã®ç®è¡æ¼ç®ãå¿ è¦ã¨ãã¾ããå®éã ã«é¢ä¸ãããã¹ã¦ã®è¦ç´ 㯠ã§ã å ã®å°ããªå®æ°ãå«ã¾ãã¦ãã¾ãããããã£ã¦ãå¼ ã¸ã®å±éã¨ã 㨠ã®è¨ç®ãå æ°å解ãããã¨ã«ããã ãæå°å¤ä»¥å¤ã®ä»»æã®ã¼ãç¹ãæ±ãããã®ãªã¼ãã¼ããããå°ãªããªããåé¡ãåãæ ¸ã¨ãªãæ´æ°è¡åä¹ç®èç© ã«åæ¸ãã¾ãããã®æ ¸ã¨ãªãä¹ç®èç©ã¯ãä»ã®ã¼ãç¹ããªã¼ã®éååã¹ãã¼ã ã§è¨ç®ããå¿ è¦ããããã®ã¨åãã§ãã å¼ ãç´ ç´ã«è¨ç®ããã¨ãä¹ç®ä»¥å¤ã«ã åã®æ¸ç®ãå¿ è¦ã«ãªã£ã¦ãã¾ãããå±éãããã¨ã§ã åã®å ç®ã«æ¸ãããã¨ãã§ããã¨è¨ã£ã¦ãã¾ãã è¨ãåããåããã«ããã§ãããç´°ããè¨ç®ããããã©ãå¼ ã®è¨ç®ãæ¯é çãªã®ã§ã対称éååã¨ã»ã¨ãã©åããããªè¨ç®éã ã¨è¨ã£ã¦ãã¨æãã¾ãã 2.4. Implementation of a typical fused layer ã»ã¯ã·ã§ã³2.3ã®è°è«ãç¶ãã¾ãããä»åã¯æ示çã«ãã¹ã¦ã®é¢é£ããæ°éã®ãã¼ã¿åãå®ç¾©ããéååãããè¡åã®ä¹ç® ãä¿®æ£ãã¦ããã¤ã¢ã¹ã®å ç®ã¨æ´»æ§åé¢æ°ã®è©ä¾¡ãç´æ¥çµ±åãã¾ãããã®å±¤å ¨ä½ãåä¸ã®æä½ã«çµ±åãããã¨ã¯ãåãªãæé©åã ãã§ã¯ããã¾ããããã¬ã¼ãã³ã°ã§ä½¿ç¨ãããç®è¡ã¨åãç®è¡ãæ¨è«ã³ã¼ãã§åç¾ããå¿ è¦ããããããæ¨è«ã³ã¼ãå ã®çµ±åãããæ¼ç®åã®ç²åº¦ï¼8ãããéååå ¥åãåãã8ãããéåååºåãçæããï¼ã¯ããã¬ã¼ãã³ã°ã°ã©ãã®ããã§ã¤ã¯éååãæ¼ç®åã®é ç½®ã¨ä¸è´ããå¿ è¦ãããã¾ãï¼ã»ã¯ã·ã§ã³3ï¼ãARMããã³x86 CPUã¢ã¼ããã¯ãã£ã§ã®å®è£ ã§ã¯ãgemmlowpã©ã¤ãã©ãª[18]ã使ç¨ãã¾ãããã®GemmWithOutputPipelineã¨ã³ããªã¼ãã¤ã³ãã¯ãæã ãããã§èª¬æããçµ±åãããæä½ããµãã¼ããã¾ãã è¡åãéã¿ã¨ãã è¡åãæ´»æ§åã¨ãã¾ããéã¿ã¨æ´»æ§åã®ä¸¡æ¹ã¯uint8åã§ãï¼int8ãé¸æãããã¨ãã§ãã¾ãããé©åã«ä¿®æ£ãããã¼ãç¹ãæã¤ï¼ãuint8å¤ã®ç©ãèç©ããã«ã¯32ãããã®ã¢ãã¥ã ã¬ã¼ã¿ãå¿ è¦ã§ãããã¢ãã¥ã ã¬ã¼ã¿ã«ã¯ããã«æããã«ãªãçç±ã§ç¬¦å·ä»ãã®åãé¸æãã¾ããå¼ ã®åè¨ã¯æ¬¡ã®å½¢å¼ã§ãï¼ éååããããã¤ã¢ã¹ã®å ç®ããint32ãã¤ã¢ã¹ããã®int32ã¢ãã¥ã ã¬ã¼ã¿ã«å ç®ãããã¨ã«ãã¾ãããã¤ã¢ã¹ãã¯ãã«ã¯æ¬¡ã®ããã«éååããã¾ãï¼int32ããã®éååããããã¼ã¿åã¨ãã¦ä½¿ç¨ãã¾ããéååã¼ãç¹ ã¨ã㦠ã使ç¨ãã¾ããããã¦ããã®éååã¹ã±ã¼ã« ã¯ãéã¿ã¨å ¥åæ´»æ§åã®ã¹ã±ã¼ã«ã®ç©ã§ããã¢ãã¥ã ã¬ã¼ã¿ã®ã¹ã±ã¼ã«ã¨åãã§ããã»ã¯ã·ã§ã³2.3ã®è¡¨è¨ã§ã¯ã ãã¤ã¢ã¹ãã¯ãã«ã¯32ãããã®å¤ã¨ãã¦éååããã¾ããããã¥ã¼ã©ã«ãããã¯ã¼ã¯ã®ãã©ã¡ã¼ã¿ã¼ã®ããä¸é¨ã«éãã¾ãããããã«ããã¤ã¢ã¹ãã¯ãã«ã®é«ã精度ã®ä½¿ç¨ã¯å®éã®å¿ è¦æ§ã«å¿ãã¾ãï¼åãã¤ã¢ã¹ãã¯ãã«ã®ã¨ã³ããªãå¤æ°ã®åºåæ´»æ§åã«å ç®ãããããããã¤ã¢ã¹ãã¯ãã«ã®éåå誤差ã¯å ¨ä½ã®ãã¤ã¢ã¹ï¼ã¤ã¾ããéã¼ãå¹³åã®ã¨ã©ã¼é ï¼ã¨ãã¦ä½ç¨ããã¨ã³ããã¼ã¨ã³ãã®ãã¥ã¼ã©ã«ãããã¯ã¼ã¯ã®ç²¾åº¦ãä¿æããããã«åé¿ããå¿ è¦ãããã¾ãã æçµçãªint32ã¢ãã¥ã ã¬ã¼ã¿ã®å¤ãæã£ã¦ãè¡ãã¹ããã¨ã3ã¤æ®ã£ã¦ãã¾ããã¾ããæçµçãªã¹ã±ã¼ã«ã«ã¹ã±ã¼ã«ãã¦ã³ãã次ã«uint8ã«ãã¦ã³ãã£ã¹ãããæçµçãª8ãããåºåæ´»æ§åãçæããããã«æ´»æ§åé¢æ°ãé©ç¨ãã¾ãã ã¹ã±ã¼ãªã³ã°ãã¦ã³ã¯ãå¼ ã®ä¹æ° ã«ãããã®ã§ããã»ã¯ã·ã§ã³2.2ã§èª¬æããããã«ãããã¯æ£è¦åãããä¹æ° ã«ããåºå®å°æ°ç¹ä¹ç®ã¨ãã©ã¦ã³ãã£ã³ã°ãããã·ããã«ãã£ã¦å®è£ ããã¾ãããã®å¾ãuint8ã«é£½åãã£ã¹ããå®è¡ããç¯å² ] ã«é£½åãã¾ãã æã ã¯ãåãªãã¯ã©ã³ãã§ããæ´»æ§åé¢æ°ã«ç¦ç¹ãå½ã¦ã¦ãã¾ããä¾ãã°ãReLUãReLU6ãªã©ã§ããæ°å¦çãªé¢æ°ã«ã¤ãã¦ã¯ãä»é²A.1ã§è°è«ããã¦ãããç¾æç¹ã§ã¯ãã®ãããªå±¤ã«çµ±åããã¦ãã¾ããããããã£ã¦ãæã ã®çµ±åãããæ´»æ§åé¢æ°ãè¡ãå¯ä¸ã®ãã¨ã¯ãæçµçãªuint8åºåæ´»æ§åãæ ¼ç´ããåã«uint8å¤ã ] ã®ããã¤ãã®ãµãåºéã«ããã«ã¯ã©ã³ããããã¨ã§ããå®éã«ã¯ãéååããããã¬ã¼ãã³ã°ããã»ã¹ï¼ã»ã¯ã·ã§ã³3ï¼ã¯ãåºåuint8 ] éå ¨ä½ãå©ç¨ããããå¦ç¿ããå¾åãããã¾ãã®ã§ãæ´»æ§åé¢æ°ã¯ãã¯ãä½ãè¡ããããã®å¹æã¯uint8ã¸ã®é£½åãã£ã¹ãã«å«ã¾ãã ] ã¸ã®ã¯ã©ã³ãã«åãè¾¼ã¾ãã¾ãã å ¥åã¨ãªããã¼ã¿ã¨éã¿ã¯ä¸¡æ¹ã¨ããuint8 ã«éååããã¦ã1ã¤ã®ã¬ã¤ã¤ãå®äºããã¨ããåºåã uint8 ã«ãªãã¾ãï¼int8 ãå¯è½ã ãã¼ããã¤ã³ãã®å¤æ´ãå¿ è¦ï¼ãuint8 ã®ç©åæ¼ç®ã®çµæ㯠32ããããå¿ è¦ã ã¨è¨ã£ã¦ãã¾ãã ãã¤ã¢ã¹ã¯ int32 ã§éååããã°ããã¦ï¼å ¥åã®ãã¼ã¿ã¨éã¿ã®è¡åæ¼ç®ã®çµæã 32bit ãªã®ã§ï¼ãã¼ããã¤ã³ã㯠ã«åºå®ããï¼32bitããã®ã§ã¼ããã¤ã³ãã¯èªç±ã«æ±ºãã¦ããã¨ãããã¨ã ã¨æãã¾ãï¼ã¨è¨ã£ã¦ãã¾ãã ãã¤ã¢ã¹ãå ç®ããå¾ã以ä¸ã®3ã¤ãè¡ãå¿ è¦ãããã¨è¨ã£ã¦ãã¾ãã æçµçãªã¹ã±ã¼ã«ï¼åºåã®ã¹ã±ã¼ã«ï¼ãé©ç¨ãã â ä¹æ° ãé©ç¨ããã㨠uint8 ã«ãã¦ã³ãã£ã¹ã æ´»æ§åé¢æ°ï¼ReLUãReLU6 ãªã©ããæ³å®ãã¦ããï¼ã®é©ç¨ æå¾ã®æ´»æ§åé¢æ°ã«ã¤ãã¦ã¯ä½ãããªãã¦ããuint8 ã«ãã¦ã³ãã£ã¹ãããã¨ãã«å¹æã¯éæã§ãã¦ãããã¨è¨ã£ã¦ãã¾ããããªãããè¨ããã®ãã¯ç解ã§ãã¾ããã§ããï¼ã¨ããã説æãã¦ãªãã¨æãï¼ãèªã¿é²ãããã¡ã«ãç解ã§ããã追è¨ãããã¨æãã¾ãã ãããã« ä»åã¯ããã¾ã§ã«ãã¾ãï¼ æå¾ã¾ã§ãèªã¿ããã ãããããã¨ããããã¾ããã