จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: เซ็ตดิฟ1D
#include <array_ops.h>
คำนวณความแตกต่างระหว่างสองรายการตัวเลขหรือสตริง
สรุป
เมื่อกำหนดรายการ x
และรายการ y
การดำเนินการนี้จะส่ง out
รายการที่แสดงถึงค่าทั้งหมดที่อยู่ใน x
แต่ไม่ใช่ใน y
รายการที่ส่ง out
จะถูกจัดเรียงตามลำดับเดียวกันกับตัวเลขที่ปรากฏใน x
(รายการที่ซ้ำกันจะถูกเก็บรักษาไว้) การดำเนินการนี้ยังส่งคืนรายการ idx
ที่แสดงถึงตำแหน่งของแต่ละ out
ใน x
กล่าวอีกนัยหนึ่ง:
out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]
ตัวอย่างเช่น เมื่อป้อนข้อมูลนี้:
x = [1, 2, 3, 4, 5, 6]
y = [1, 3, 5]
การดำเนินการนี้จะกลับมา:
out ==> [2, 4, 6]
idx ==> [1, 3, 5]
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- x: 1-D คุณค่าที่ต้องเก็บไว้
- ย: 1-D ค่าที่จะลบ
ผลตอบแทน:
- เอา
Output
ท: 1-D ค่ามีอยู่ใน x
แต่ไม่ใช่ใน y
- รหัส
Output
: 1-D ตำแหน่งของค่า x
เก็บรักษาไว้ด้าน out
ฟังก์ชันคงที่สาธารณะ |
---|
OutIdx (DataType x) | |
คุณลักษณะสาธารณะ
งานสาธารณะ
ฟังก์ชันคงที่สาธารณะ
OutIdx
Attrs OutIdx(
DataType x
)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[],[],null,["# tensorflow::ops::SetDiff1D Class Reference\n\ntensorflow::ops::SetDiff1D\n==========================\n\n`#include \u003carray_ops.h\u003e`\n\nComputes the difference between two lists of numbers or strings.\n\nSummary\n-------\n\nGiven a list `x` and a list `y`, this operation returns a list `out` that represents all values that are in `x` but not in `y`. The returned list `out` is sorted in the same order that the numbers appear in `x` (duplicates are preserved). This operation also returns a list `idx` that represents the position of each `out` element in `x`. In other words:\n\n\n`out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]`\n\nFor example, given this input:\n\n\n```text\nx = [1, 2, 3, 4, 5, 6]\ny = [1, 3, 5]\n```\n\n\u003cbr /\u003e\n\nThis operation would return:\n\n\n```text\nout ==\u003e [2, 4, 6]\nidx ==\u003e [1, 3, 5]\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- x: 1-D. Values to keep.\n- y: 1-D. Values to remove.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) out: 1-D. Values present in `x` but not in `y`.\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) idx: 1-D. Positions of `x` values preserved in `out`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [SetDiff1D](#classtensorflow_1_1ops_1_1_set_diff1_d_1a6710b0de19cc8ed8db1fd0affa254ef2)`(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)` x, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` y)` ||\n| [SetDiff1D](#classtensorflow_1_1ops_1_1_set_diff1_d_1ab8dc6a2fee78ba148fd712ea5d8b54c5)`(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)` x, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` y, const `[SetDiff1D::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/set-diff1-d/attrs#structtensorflow_1_1ops_1_1_set_diff1_d_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [idx](#classtensorflow_1_1ops_1_1_set_diff1_d_1a7a2e1946513c22df219161e501162ab0) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_set_diff1_d_1a1339e3af48083e545565ddaa7b259eb8) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [out](#classtensorflow_1_1ops_1_1_set_diff1_d_1a9ce116feeef14a58ab2608142f3b632b) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| [OutIdx](#classtensorflow_1_1ops_1_1_set_diff1_d_1aa928e875080781e6e3d4fd2e82eca555)`(DataType x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/set-diff1-d/attrs#structtensorflow_1_1ops_1_1_set_diff1_d_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::SetDiff1D::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/set-diff1-d/attrs) | Optional attribute setters for [SetDiff1D](/versions/r2.3/api_docs/cc/class/tensorflow/ops/set-diff1-d#classtensorflow_1_1ops_1_1_set_diff1_d). |\n\nPublic attributes\n-----------------\n\n### idx\n\n```text\n::tensorflow::Output idx\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\n### out\n\n```text\n::tensorflow::Output out\n``` \n\nPublic functions\n----------------\n\n### SetDiff1D\n\n```gdscript\n SetDiff1D(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input x,\n ::tensorflow::Input y\n)\n``` \n\n### SetDiff1D\n\n```gdscript\n SetDiff1D(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input x,\n ::tensorflow::Input y,\n const SetDiff1D::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### OutIdx\n\n```text\nAttrs OutIdx(\n DataType x\n)\n```"]]