تينسورفلو :: العمليات :: 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 :: العمليات :: OneHot :: Attrs |
السمات العامة
عملية
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 :: Output
operator::tensorflow::Output() const
وظائف ثابتة عامة
محور
026 fce95a0إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2020-04-20 (حسب التوقيت العالمي المتفَّق عليه)