tensorflow :: ops :: OneHot
#include <array_ops.h>
یک تانسور یک گرم برمی گرداند.
خلاصه
مکانهایی که توسط شاخص ها در indices
می on_value
، مقدار را on_value
، در حالی که تمام مکان های دیگر از off_value
برخوردار می off_value
.
اگر indices
ورودی رتبه N
، خروجی دارای درجه N+1
، محور جدید در axis
بعد ایجاد axis
(پیش فرض: محور جدید در انتها ضمیمه می شود).
اگر indices
ها یک اسکالر باشد ، شکل خروجی بردار depth
طول خواهد بود.
اگر indices
بردار features
طول 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) ]
استدلال ها:
- دامنه: یک شی Sc Scope
- شاخص ها: تنش کننده شاخص ها.
- deep: اسکالری است که عمق یک بعد گرم را تعریف می کند.
- 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 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2020-04-20 بهوقت ساعت هماهنگ جهانی.