จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: หนาแน่นBincount
#include <math_ops.h>
นับจำนวนครั้งของแต่ละค่าในอาร์เรย์จำนวนเต็ม
สรุป
ส่งออกเวกเตอร์ที่มี size
ความยาวและประเภท dtype เดียวกันกับ weights
หาก weights
ว่างเปล่า ดัชนี i
จะเก็บจำนวนครั้งที่นับค่า i
ใน arr
หาก weights
ไม่ว่างเปล่า ดัชนี i
จะจัดเก็บผลรวมของค่าใน weights
ไว้ที่แต่ละดัชนี โดยที่ค่าที่สอดคล้องกันใน arr
คือ i
ค่าที่ arr
นอกช่วง [0, ขนาด) จะถูกละเว้น
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- อินพุต: 1D หรือ 2D int
Tensor
- ขนาด:
Tensor
เกลาร์ int ไม่เป็นลบ - น้ำหนัก: คือ int32, int64, float32 หรือ float64
Tensor
ที่มีรูปร่างเหมือนกับ arr
หรือ length-0 Tensor
ซึ่งในกรณีนี้จะทำหน้าที่เป็นน้ำหนักทั้งหมดเท่ากับ 1
แอ็ตทริบิวต์ทางเลือก (ดู Attrs
):
- binary_output: บูล; ไม่ว่าเคอร์เนลควรนับลักษณะที่ปรากฏหรือจำนวนครั้งที่เกิดขึ้น
ผลตอบแทน:
-
Output
: 1D Tensor
ที่มีความยาวเท่ากับ size
หรือ 2D Tensor
ที่มี [batch_size, size
] จำนวนหรือน้ำหนักรวมของแต่ละค่าในช่วง [0, ขนาด)
คุณลักษณะสาธารณะ
งานสาธารณะ
โหนด
::tensorflow::Node * node() const
operator::tensorflow::Input() const
ตัวดำเนินการ::tensorflow::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
BinaryOutput
Attrs BinaryOutput(
bool x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::DenseBincount Class Reference\n\ntensorflow::ops::DenseBincount\n==============================\n\n`#include \u003cmath_ops.h\u003e`\n\nCounts the number of occurrences of each value in an integer array.\n\nSummary\n-------\n\nOutputs a vector with length `size` and the same dtype as `weights`. If `weights` are empty, then index `i` stores the number of times the value `i` is counted in `arr`. If `weights` are non-empty, then index `i` stores the sum of the value in `weights` at each index where the corresponding value in `arr` is `i`.\n\nValues in `arr` outside of the range \\[0, size) are ignored.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: 1D or 2D int [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n- size: non-negative int scalar [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n- weights: is an int32, int64, float32, or float64 [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) with the same shape as `arr`, or a length-0 [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor), in which case it acts as all weights equal to 1.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/dense-bincount/attrs#structtensorflow_1_1ops_1_1_dense_bincount_1_1_attrs)):\n\n- binary_output: bool; Whether the kernel should count the appearance or number of occurrences.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 1D [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) with length equal to `size` or 2D [Tensor](/versions/r2.3/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) with \\[batch_size, `size`\\]. The counts or summed weights for each value in the range \\[0, size).\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DenseBincount](#classtensorflow_1_1ops_1_1_dense_bincount_1ab02953a432ff72a2a17beaf962267085)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` size, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` weights)` ||\n| [DenseBincount](#classtensorflow_1_1ops_1_1_dense_bincount_1a35f740d0e88d21d9fda3f036ab191f5f)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` size, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` weights, const `[DenseBincount::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/dense-bincount/attrs#structtensorflow_1_1ops_1_1_dense_bincount_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_dense_bincount_1a530c866f76f77857645c04629ff95f0f) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_dense_bincount_1a72cd36e267012d1fba1f52d9fc5dbdde) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_dense_bincount_1afe5ba5aab8439e56df2cb121e22cdab4)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_dense_bincount_1ae0ec3cf397401ec119f7a80af6b90207)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_dense_bincount_1a094e2333d7032966f32eeba7350a532c)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [BinaryOutput](#classtensorflow_1_1ops_1_1_dense_bincount_1ade99d480052f18d963d715c56162434b)`(bool x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/dense-bincount/attrs#structtensorflow_1_1ops_1_1_dense_bincount_1_1_attrs) |\n\n| ### Structs ||\n|----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DenseBincount::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/dense-bincount/attrs) | Optional attribute setters for [DenseBincount](/versions/r2.3/api_docs/cc/class/tensorflow/ops/dense-bincount#classtensorflow_1_1ops_1_1_dense_bincount). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### DenseBincount\n\n```gdscript\n DenseBincount(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input size,\n ::tensorflow::Input weights\n)\n``` \n\n### DenseBincount\n\n```gdscript\n DenseBincount(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input size,\n ::tensorflow::Input weights,\n const DenseBincount::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### BinaryOutput\n\n```text\nAttrs BinaryOutput(\n bool x\n)\n```"]]