ee.Reducer.forEachElement
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ลดแต่ละตำแหน่งในอินพุตอาร์เรย์ที่มีรูปร่างเท่ากันแยกกัน ทำให้ได้เอาต์พุตอาร์เรย์ที่มีรูปร่างเดียวกัน
ตัวอย่างเช่น เมื่อใช้ตัวลด "sum" กับอาร์เรย์ 5 รายการที่มีรูปร่าง 2x2 เอาต์พุตจะเป็นอาร์เรย์ 2x2 โดยแต่ละตำแหน่งคือผลรวมของค่า 5 ค่าในตำแหน่งนั้น
การใช้งาน | การคืนสินค้า |
---|
Reducer.forEachElement() | ตัวลดตำแหน่ง |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ reducer | ตัวลดตำแหน่ง | ตัวลดที่จะใช้กับองค์ประกอบอาร์เรย์แต่ละรายการ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eApplies a reducer function to corresponding elements across multiple arrays of the same shape.\u003c/p\u003e\n"],["\u003cp\u003eOutputs a single array mirroring the input shape, with each element representing the reduced value of corresponding input elements.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility through the \u003ccode\u003eforEachElement\u003c/code\u003e method to specify the reducer function.\u003c/p\u003e\n"],["\u003cp\u003eIllustrated with an example using the 'sum' reducer to aggregate values across five 2x2 arrays into a resultant 2x2 array.\u003c/p\u003e\n"]]],[],null,["# ee.Reducer.forEachElement\n\nSeparately reduces each position in array inputs of equal shape, producing an array output of the same shape.\n\n\u003cbr /\u003e\n\nFor example, with the 'sum' reducer applied to 5 arrays with shape 2x2, the output will be a 2x2 array, where each position is the sum of the 5 values at that position.\n\n| Usage | Returns |\n|----------------------------|---------|\n| Reducer.forEachElement`()` | Reducer |\n\n| Argument | Type | Details |\n|-----------------|---------|---------------------------------------------|\n| this: `reducer` | Reducer | The reducer to apply to each array element. |"]]