Gibt es eine Möglichkeit, Gewichte über parallele Ströme eines Fackelmodells zu teilen?Wie teile ich Gewichtungen über Parallel-Streams?
Zum Beispiel habe ich das folgende Modell.
mlp = nn.Sequential();
c = nn.Parallel(1,2) -- Parallel container will associate a module to each slice of dimension 1
-- (row space), and concatenate the outputs over the 2nd dimension.
for i=1,10 do -- Add 10 Linear+Reshape modules in parallel (input = 3, output = 2x1)
local t=nn.Sequential()
t:add(nn.Linear(3,2)) -- Linear module (input = 3, output = 2)
t:add(nn.Reshape(2,1)) -- Reshape 1D Tensor of size 2 to 2D Tensor of size 2x1
c:add(t)
end
mlp:add(c)
Nun möchte ich das Gewicht (einschließlich alles, Gewichte, bias, Gradienten) teilen, der nn.Linear
Schicht oberhalb über eine unterschiedliche Anzahl von i
(so beispiels nn.Linear(3,2)[1]
mit nn.Linear(3,2)[9]
). Welche Möglichkeiten habe ich, diese zu teilen?
Oder wird es eher empfohlen, einen anderen Container/den Modulansatz zu verwenden?