Torch: Possible fix for NPE

Signed-off-by: Chintan Shah <cgintan1998@gmail.com>