Efficient Rematerialization for Deep Networks