@@ -152,14 +152,18 @@ end
152
152
function _rebuild! (x, off, flat:: AbstractVector , len = length (flat); walk = _Trainable_biwalk (), kw... )
153
153
len == length (flat) || throw (DimensionMismatch (" Rebuild expected a vector of length $len , got $(length (flat)) " ))
154
154
fmap (x, off; exclude = isnumeric, walk, kw... ) do y, o
155
- copyto! (y, _getat (y, o, flat, view))
155
+ # copyto!(y, _getat_view(y, o, flat))
156
+ copyto! (y, 1 , flat, o+ 1 , length (y))
156
157
end
157
158
x
158
159
end
159
160
160
- _getat (y:: Number , o:: Int , flat:: AbstractVector , _... ) = ProjectTo (y)(flat[o + 1 ])
161
- _getat (y:: AbstractArray , o:: Int , flat:: AbstractVector , get= getindex) =
162
- ProjectTo (y)(reshape (get (flat, o .+ (1 : length (y))), axes (y))) # ProjectTo is just correcting eltypes
161
+ _getat (y:: Number , o:: Int , flat:: AbstractVector ) = ProjectTo (y)(flat[o + 1 ])
162
+ _getat (y:: AbstractArray , o:: Int , flat:: AbstractVector ) =
163
+ ProjectTo (y)(reshape (flat[o .+ (1 : length (y))], axes (y))) # ProjectTo is just correcting eltypes
164
+
165
+ # _getat_view(y::AbstractArray, o::Int, flat::AbstractVector) =
166
+ # view(flat, o .+ (1:length(y)))
163
167
164
168
struct _Trainable_biwalk <: AbstractWalk end
165
169
0 commit comments