tensorflow:: ops:: OneHot
#include <array_ops.h>تُرجع هذه الدالة موترًا أحادي الترميز.
ملخص
تأخذ المواقع الممثلة بالمؤشرات في indices القيمة on_value ، بينما تأخذ جميع المواقع الأخرى القيمة off_value .
إذا كانت رتبة indices الإدخال N ، فسيكون للإخراج رتبة N+1 ، ويتم إنشاء المحور الجديد عند axis البعد (الافتراضي: يتم إلحاق المحور الجديد في النهاية).
إذا كانت indices قيمة عددية، فسيكون شكل الإخراج عبارة عن متجه بطول depth .
إذا كانت indices عبارة عن متجه من features ذات الطول ، فسيكون شكل الإخراج كالتالي:
features x depth if axis == -1 depth x features if axis == 0
إذا كانت indices عبارة عن مصفوفة (دفعة) ذات شكل [batch, features] ، فسيكون شكل الإخراج كما يلي:
batch x features x depth if axis == -1 batch x depth x features if axis == 1 depth x batch x features if axis == 0
أمثلة
لنفترض أن
indices = [0, 2, -1, 1] depth = 3 on_value = 5.0 off_value = 0.0 axis = -1
ثم يكون الناتج [4 x 3] :
output = [5.0 0.0 0.0] // one_hot(0) [0.0 0.0 5.0] // one_hot(2) [0.0 0.0 0.0] // one_hot(-1) [0.0 5.0 0.0] // one_hot(1)
لنفترض أن
indices = [0, 2, -1, 1] depth = 3 on_value = 0.0 off_value = 3.0 axis = 0
ثم يكون الناتج [3 x 4] :
output = [0.0 3.0 3.0 3.0] [3.0 3.0 3.0 0.0] [3.0 3.0 3.0 3.0] [3.0 0.0 3.0 3.0] // ^ one_hot(0) // ^ one_hot(2) // ^ one_hot(-1) // ^ one_hot(1)
لنفترض أن
indices = [[0, 2], [1, -1]] depth = 3 on_value = 1.0 off_value = 0.0 axis = -1
ثم يكون الناتج [2 x 2 x 3] :
output =
[
[1.0, 0.0, 0.0] // one_hot(0)
[0.0, 0.0, 1.0] // one_hot(2)
][
[0.0, 1.0, 0.0] // one_hot(1)
[0.0, 0.0, 0.0] // one_hot(-1)
]الحجج:
- النطاق: كائن النطاق
- المؤشرات: موتر من المؤشرات.
- العمق: قيمة عددية تحدد عمق البعد الأحادي الساخن.
- on_value: قيمة عددية تحدد القيمة المراد ملؤها في المخرجات عندما
indices[j] = i. - off_value: قيمة عددية تحدد القيمة التي سيتم ملؤها في المخرجات عندما
indices[j] != i.
السمات الاختيارية (انظر Attrs ):
- المحور: المحور المراد ملؤه (الافتراضي: -1، وهو محور داخلي جديد).
المرتجعات:
-
Output: موتر الترميز الأحادي.
البناة والمدمرون | |
|---|---|
OneHot (const :: tensorflow::Scope & scope, :: tensorflow::Input indices, :: tensorflow::Input depth, :: tensorflow::Input on_value, :: tensorflow::Input off_value) | |
OneHot (const :: tensorflow::Scope & scope, :: tensorflow::Input indices, :: tensorflow::Input depth, :: tensorflow::Input on_value, :: tensorflow::Input off_value, const OneHot::Attrs & attrs) |
السمات العامة | |
|---|---|
operation | |
output | |
الوظائف العامة | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
الدوال الثابتة العامة | |
|---|---|
Axis (int64 x) | |
الهياكل | |
|---|---|
| tensorflow:: ops:: OneHot:: Attrs | أدوات تعيين السمات الاختيارية لـ OneHot . |
السمات العامة
عملية
Operation operation
المخرجات
::tensorflow::Output output
الوظائف العامة
ون هوت
OneHot( const ::tensorflow::Scope & scope, ::tensorflow::Input indices, ::tensorflow::Input depth, ::tensorflow::Input on_value, ::tensorflow::Input off_value )
ون هوت
OneHot( const ::tensorflow::Scope & scope, ::tensorflow::Input indices, ::tensorflow::Input depth, ::tensorflow::Input on_value, ::tensorflow::Input off_value, const OneHot::Attrs & attrs )
العقدة
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
الدوال الثابتة العامة
محور
Attrs Axis( int64 x )
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2026-11-05 (حسب التوقيت العالمي المتفَّق عليه)