সেন্সরফ্লো :: অপস :: গ্যাটারএনডি
#include <array_ops.h>
জড়ো করা থেকে টুকরা params
একটি মধ্যে টেন্সর দ্বারা নির্দিষ্ট আকৃতি সঙ্গে indices
।
সারসংক্ষেপ
indices
একটি K-মাত্রিক পূর্ণসংখ্যা টেন্সর, শ্রেষ্ঠ চিন্তা মধ্যে সূচকের একটি (কে -1) -dimensional টেন্সর যেমন params
, যেখানে প্রতিটি উপাদান একটি ফালি সংজ্ঞায়িত params
:
output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]
যেহেতু tf.gather
indices
মধ্যে সংজ্ঞায়িত টুকরা axis
মাত্রা params
, ইন tf.gather_nd
, indices
প্রথম মধ্যে সংজ্ঞায়িত টুকরা N
এর মাত্রা params
, যেখানে N = indices.shape[-1]
।
শেষ মাত্রা indices
সর্বাধিক হতে পারে পদে params
:
indices.shape[-1] <= params.rank
শেষ মাত্রা indices
উপাদানের সাথে সঙ্গতিপূর্ণ (যদি indices.shape[-1] == params.rank
) অথবা টুকরা (যদি indices.shape[-1] < params.rank
) মাত্রা বরাবর indices.shape[-1]
এর params
। আউটপুট টেনসরটির আকার
indices.shape[:-1] + params.shape[indices.shape[-1]:]রয়েছে
নোট করুন যে সিপিইউ-তে, যদি কোনও বাইন্ড ইনডেক্স পাওয়া যায়, একটি ত্রুটি ফিরে আসে is জিপিইউ-তে, যদি কোনও বাহ্যিক সূচক খুঁজে পাওয়া যায়, তবে 0 0 সংশ্লিষ্ট আউটপুট মানে সংরক্ষণ করা হয়।
নীচে কিছু উদাহরণ।
ম্যাট্রিক্সে সরল সূচীকরণ:
indices = [[0, 0], [1, 1]] params = [['a', 'b'], ['c', 'd']] output = ['a', 'd']
ম্যাট্রিক্সে স্লাইস ইনডেক্সিং:
indices = [[1], [0]] params = [['a', 'b'], ['c', 'd']] output = [['c', 'd'], ['a', 'b']]
একটি 3-টেনসারে সূচক:
indices = [[1]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[['a1', 'b1'], ['c1', 'd1']]]
indices = [[0, 1], [1, 0]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [['c0', 'd0'], ['a1', 'b1']]
indices = [[0, 0, 1], [1, 0, 1]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = ['b0', 'b1']
ম্যাট্রিক্সে ব্যাচড ইনডেক্সিং:
indices = [[[0, 0]], [[0, 1]]] params = [['a', 'b'], ['c', 'd']] output = [['a'], ['b']]
ব্যাচযুক্ত স্লাইসকে ম্যাট্রিক্সে সূচি:
indices = [[[1]], [[0]]] params = [['a', 'b'], ['c', 'd']] output = [[['c', 'd']], [['a', 'b']]]
একটি 3-টেন্সরের মধ্যে ব্যাচড ইনডেক্সিং:
indices = [[[1]], [[0]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[[['a1', 'b1'], ['c1', 'd1']]], [[['a0', 'b0'], ['c0', 'd0']]]]
indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [[['c0', 'd0'], ['a1', 'b1']], [['a0', 'b0'], ['c1', 'd1']]]
indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]] params = [[['a0', 'b0'], ['c0', 'd0']], [['a1', 'b1'], ['c1', 'd1']]] output = [['b0', 'b1'], ['d0', 'c1']]
tf.gather
এবং tf.batch_gather
।
যুক্তি:
- সুযোগ: একটি স্কোপ অবজেক্ট
- প্যারাম: টেনসর যা থেকে মান সংগ্রহ করা।
- সূচকগুলি: সূচক টেনসর।
রিটার্নস:
-
Output
থেকে মানগুলিparams
কর্তৃক প্রদত্ত সূচকের থেকে সংগৃহীতindices
, আকৃতি সঙ্গেindices.shape[:-1] + params.shape[indices.shape[-1]:]
।
নির্মাণকারী এবং ধ্বংসকারী | |
---|---|
GatherNd (const :: tensorflow::Scope & scope, :: tensorflow::Input params, :: tensorflow::Input indices) |
জনসাধারণের গুণাবলী | |
---|---|
operation | |
output |
পাবলিক ফাংশন | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
জনসাধারণের গুণাবলী
অপারেশন
Operation operation
আউটপুট
::tensorflow::Output output
পাবলিক ফাংশন
গ্যাটারএনডি
GatherNd( const ::tensorflow::Scope & scope, ::tensorflow::Input params, ::tensorflow::Input indices )
নোড
::tensorflow::Node * node() const
অপারেটর :: টেনসরফ্লো :: ইনপুট
operator::tensorflow::Input() const
অপারেটর :: টেনসরফ্লো :: আউটপুট
operator::tensorflow::Output() const