@@ -35,15 +35,12 @@ function _batch_map!(f::F, bnlp::InplaceBatchNLPModel, xs::Vararg{T,N}) where {F
3535 n = bnlp. batch_size
3636 length (xs) == 0 && error (" Cannot call _batch_map! without providing arguments." )
3737 @lencheck_tup n xs
38- outputs = xs[end ]
39- inputs = length (xs) == 1 ? () : Base. ntuple (i -> xs[i], length (xs) - 1 )
40- @lencheck n outputs
4138 for i = 1 : n
42- args_i = (x[i] for x in inputs )
39+ args_i = (x[i] for x in xs )
4340 bnlp. updates[i](bnlp. base_model) # call update function
44- f (bnlp. base_model, args_i... , outputs[i] )
41+ f (bnlp. base_model, args_i... )
4542 end
46- return outputs
43+ return xs[ end ]
4744end
4845
4946function _batch_map_weight (f:: F , bnlp:: InplaceBatchNLPModel , obj_weights, xs:: Vararg{T,N} ) where {F,T,N}
@@ -65,15 +62,12 @@ function _batch_map_weight!(f::F, bnlp::InplaceBatchNLPModel, obj_weights, xs::V
6562 length (xs) == 0 && error (" _batch_map_weight! with zero args" )
6663 @lencheck_tup n xs
6764 @lencheck n obj_weights
68- outputs = xs[end ]
69- inputs = length (xs) == 1 ? () : Base. ntuple (i -> xs[i], length (xs) - 1 )
70- @lencheck n outputs
7165 for i = 1 : n
72- args_i = (x[i] for x in inputs )
66+ args_i = (x[i] for x in xs )
7367 bnlp. updates[i](bnlp. base_model) # call update function
74- f (bnlp. base_model, args_i... , outputs[i] ; obj_weight = obj_weights[i])
68+ f (bnlp. base_model, args_i... ; obj_weight = obj_weights[i])
7569 end
76- return outputs
70+ return xs[ end ]
7771end
7872
7973function _batch_map_tuple (f:: F , bnlp:: InplaceBatchNLPModel , xs:: Vararg{T,N} ) where {F,T,N}
0 commit comments