chainer.functions.select_item(x, t)[source]

指定されたインデクスに格納されている要素を選択する。

 

この関数は t.choose(x.T)を返します。 つまり全ての iについて y[i] == x[i, t[i]] 。

Parameters:
Returns:

 xの t番目の要素をもつVariable

Return type:

Variable

 

Example


>>> x = np.array([[0, 1, 2], [3, 4, 5]], 'f')

>>> t = np.array([0, 2], 'i')
>>> y = F.select_item(x, t)
>>> y.shape (2,)
>>> y.data
array([ 0., 5.], dtype=float32)