Thoughts on the syntactic sugar unsqueeze(-1)?

TensorFlow has tf.expand_dims(x, -1). It’s not a big deal, but being able to write x.unsqueeze(-1) is a lot nicer than x.unsqueeze(len(x.size()). Agree? Disagree?

this is soon coming to pytorch with: https://github.com/pytorch/pytorch/pull/1108

1 Like