I am trying to do something like [0 if i < 1 else 1] for PyTorch tensor in C++. I tried to use tensor.accessor(), but it seem like it require you to know the dimension beforehand. While I want to pass it dynamically.
Is there anyway I could do this in C++ for Pytorch?