you cannot do this for all model parameters, just because each parameter is on a separate storage. Concatenating them together will give you all of them together in a different storage (memory location).
This kind of flattening model parameters used to be a thing in (Lua)Torch, but we got rid of it.
What exactly is your use-case, maybe we can help find you a solution?
For something like LBFGS that needs a consistent single view, we have these helper functions, but they do things out of place (get a flattened view, then compute stuff, then push back gradients back):
Thank you for the code snippet. That is the solution that I settled upon but, yes, I wanted something like what you described as being present only in Lua torch.
My use case is that I added an optimizer that wants all the parameters in vector form (ported from Matlab). Just wanted to avoid the copies.
What I have works for now. Maybe, between projects, I’ll hit you guys with a pull request with an attempt to re-add this functionality.