Libtorch: how to reshape to a dynamic dims

I have a dynamic shape maybe ( 1, …,). then How to view a tensor to this shape in C++ with libtorch.
I know tensor.view({1, 3, 4, 4}), but this is static with pre-known dim.
how about tensor.view(dynamic_shape)? thank you!

I’m not sure I understand the question correctly. You could still define the dynamic_shape during the runtime, which would make it “dynamic”, wouldn’t it?

thank u for your replay, I mean vector as input shape