By your v and  i, you are constructing a 2d tensor with one nonzero entry at 1,0.
p.size() is [2] and this is one-dimensional. If you pass a size object with two elements as last argument, it’ll work.
Best regards
Thomas