تدفق التوتر:: العمليات:: 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 ):
- axis: المحور المطلوب ملؤه (الافتراضي: -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
OneHot( const ::tensorflow::Scope & scope, ::tensorflow::Input indices, ::tensorflow::Input depth, ::tensorflow::Input on_value, ::tensorflow::Input off_value )
OneHot
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
المشغل::tensorflow::الإدخال
operator::tensorflow::Input() const
المشغل::tensorflow::الإخراج
operator::tensorflow::Output() const
وظائف ثابتة العامة
محور
Attrs Axis( int64 x )
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)