patches for upstream cutorch changes