We use chainer.functions.linear
to compute y=Wx+b
.
In my case, I have to implement a linear link with one more dimension.
Say the input example is (c, x)
, the desired output is then y = W_c x + b
. Let's ignore the bias and make it y = W_c x
.
The cardinal number of {c}
is known in advance (usually classes of samples).
Theoretically the W
parameter can be implemented as a 3-d tensor (C, y_dims, x_dims)
. But what else? Do I have to iterate over the batch and extract W_c
in shape (y_dims, x_dims)
and call functions.linear
merely for that (1, x_dims)
-shaped example?