You can use this code until it is not implemented officially (I do not have it on 0.4.1) https://gist.github.com/ferrine/0c0e03bd21323a048baab8dadc83cdcc 78
UPD after experiments with torch script I failed to make it faster than loop implementation