tensorflow:: ops:: GatherNd

#include <array_ops.h>

params থেকে স্লাইসগুলিকে indices দ্বারা নির্দিষ্ট আকারের একটি টেনসরে সংগ্রহ করুন ।

সারসংক্ষেপ

indices হলো একটি K-মাত্রিক পূর্ণসংখ্যা টেনসর, যাকে params এর সূচকসমূহের একটি (K-1)-মাত্রিক টেনসর হিসেবে ভাবা সবচেয়ে ভালো, যেখানে প্রতিটি উপাদান params এর একটি স্লাইসকে সংজ্ঞায়িত করে:

output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]

যেখানে tf.gather এ indices params এর প্রথম ডাইমেনশনের মধ্যে স্লাইস নির্ধারণ করে, সেখানে tf.gather_nd এ indices , params এর প্রথম N ডাইমেনশনের মধ্যে স্লাইস নির্ধারণ করে, যেখানে N = indices.shape[-1] ।

indices শেষ মাত্রা সর্বাধিক params এর র‍্যাঙ্ক হতে পারে:

indices.shape[-1] <= params.rank

indices এর শেষ ডাইমেনশনটি params এর indices.shape[-1] == params.rank ) অথবা স্লাইস (যদি indices.shape indices.shape[-1] indices.shape[-1] < params.rank )-এর সাথে সঙ্গতিপূর্ণ। আউটপুট টেনসরের শেপ হলো

indices.shape[:-1] + params.shape[indices.shape[-1]:]

উল্লেখ্য যে, সিপিইউ-তে সীমার বাইরের কোনো ইনডেক্স পাওয়া গেলে একটি এরর দেখানো হয়। জিপিইউ-তে সীমার বাইরের কোনো ইনডেক্স পাওয়া গেলে সংশ্লিষ্ট আউটপুট ভ্যালুতে একটি ০ স্টোর করা হয়।

নীচে কিছু উদাহরণ দেওয়া হল।

ম্যাট্রিক্সে সরল সূচীকরণ:

    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']]

একটি ৩-টেনসরের সূচীকরণ:

    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']]]

একটি ৩-টেনসরে ব্যাচড ইন্ডেক্সিং:

    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 ।

যুক্তি:

  • স্কোপ: একটি স্কোপ অবজেক্ট
  • params: যে টেনসর থেকে মানগুলো সংগ্রহ করা হবে।
  • indices: সূচক টেনসর।

ফেরত:

  • Output : indices দ্বারা প্রদত্ত indices থেকে সংগৃহীত params এর মানসমূহ, যার আকৃতি 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