diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -70,7 +70,7 @@
 getLibtorchVersion = do
   mVersion <- lookupEnv "LIBTORCH_VERSION"
   case mVersion of
-    Nothing -> return "2.5.0"
+    Nothing -> return "2.9.1"
     Just other -> return other
 
 getLocalUserLibtorchDir :: IO FilePath
@@ -97,7 +97,7 @@
 
 getCudaFlavor :: IO String
 getCudaFlavor = do
-  fromMaybe "cpu" <$> lookupEnv "LIBTORCH_CUDA_VERSION"  -- "cpu" | "cu117" | "cu118" | "cu121"
+  fromMaybe "cpu" <$> lookupEnv "LIBTORCH_CUDA_VERSION"  -- "cpu" | "cu126" | "cu128" | "cu130"
 
 ensureLibtorch :: IO (Maybe FilePath)
 ensureLibtorch = do
@@ -188,9 +188,9 @@
                  , "libtorch-macos-x86_64.zip" )
       _       -> error "Unsupported macOS arch"
     Linux -> case flavor of
-      "cpu"  -> ( "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-" ++ v ++ "%2Bcpu.zip"
+      "cpu"  -> ( "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-" ++ v ++ "%2Bcpu.zip"
                 , "libtorch-linux.zip" )
-      cudaVersion -> ( "https://download.pytorch.org/libtorch/" ++ cudaVersion ++"/libtorch-cxx11-abi-shared-with-deps-" ++ v ++ "%2B" ++ cudaVersion ++ ".zip"
+      cudaVersion -> ( "https://download.pytorch.org/libtorch/" ++ cudaVersion ++"/libtorch-shared-with-deps-" ++ v ++ "%2B" ++ cudaVersion ++ ".zip"
                 , "libtorch-linux-" ++ cudaVersion ++ ".zip" )
     Windows -> error "Windows not supported by this setup"
 
diff --git a/libtorch-ffi.cabal b/libtorch-ffi.cabal
--- a/libtorch-ffi.cabal
+++ b/libtorch-ffi.cabal
@@ -1,6 +1,6 @@
 cabal-version:       3.0
 name:                libtorch-ffi
-version:             2.0.1.9
+version:             2.0.1.10
 -- The prefix(2.0) of this version("2.0.0.0") is the same as libtorch's one.
 synopsis:            Haskell bindings for PyTorch
 description:         This package provides Haskell bindings to libtorch, the C++ library underlying PyTorch, specifically designed for the Hasktorch ecosystem.
@@ -155,9 +155,8 @@
  build-depends:       base >= 4.7 && < 5
                     , inline-c-cpp >= 0.5.0.2 && < 0.6.0.0
                     , inline-c >= 0.9.1.10 && < 0.10
-                    , optparse-applicative >= 0.14.3.0 && < 0.19
                     , containers >= 0.6.7 && < 0.8
-                    , template-haskell >= 2.20.0 && < 2.23
+                    , template-haskell >= 2.20.0 && < 2.24
                     , bytestring >= 0.11.5 && < 0.13
                     , safe-exceptions >= 0.1.7 && < 0.2
                     , sysinfo >= 0.1.1 && < 0.2
@@ -193,6 +192,9 @@
   if !flag(gcc)
     cxx-options:       -std=c++17
     ghc-options:       -optcxx-std=c++17
+ else
+  cxx-options:       -std=c++17
+  ghc-options:       -optcxx-std=c++17
  default-extensions:          Strict
                             , StrictData
  cxx-sources:          csrc/hasktorch_finalizer.cpp
diff --git a/src/Torch/Internal/Managed/Autograd.hs b/src/Torch/Internal/Managed/Autograd.hs
--- a/src/Torch/Internal/Managed/Autograd.hs
+++ b/src/Torch/Internal/Managed/Autograd.hs
@@ -14,6 +14,8 @@
 grad :: ForeignPtr Tensor -> ForeignPtr TensorList -> IO (ForeignPtr TensorList)
 grad = _cast2 Unmanaged.grad
 
+gradWithOptions :: Bool -> Bool -> Bool -> ForeignPtr Tensor -> ForeignPtr TensorList -> IO (ForeignPtr TensorList)
+gradWithOptions = _cast5 Unmanaged.gradWithOptions
 
 makeIndependent :: ForeignPtr Tensor -> CBool -> IO (ForeignPtr Tensor)
 makeIndependent = _cast2 Unmanaged.makeIndependent
diff --git a/src/Torch/Internal/Unmanaged/Autograd.hs b/src/Torch/Internal/Unmanaged/Autograd.hs
--- a/src/Torch/Internal/Unmanaged/Autograd.hs
+++ b/src/Torch/Internal/Unmanaged/Autograd.hs
@@ -25,7 +25,10 @@
 C.include "<ATen/core/functional.h>"
 
 grad :: Ptr Tensor -> Ptr TensorList -> IO (Ptr TensorList)
-grad y inputs = [C.throwBlock| std::vector<at::Tensor>* {
+grad = gradWithOptions 1 0 0
+
+gradWithOptions :: CBool -> CBool -> CBool -> Ptr Tensor -> Ptr TensorList -> IO (Ptr TensorList)
+gradWithOptions keepGraph createGraph accumulateGrad y inputs = [C.throwBlock| std::vector<at::Tensor>* {
     torch::autograd::Variable y = *$(at::Tensor* y);
     const auto & inputs = *$(std::vector<at::Tensor>* inputs);
 
@@ -59,9 +62,9 @@
 
     auto & engine = torch::autograd::Engine::get_default_engine();
     auto outputs = engine.execute(roots, grads,
-                                  /*keep_graph=*/true,
-                                  /*create_graph=*/false,
-                                  /*accumulate_grad=*/false, // https://github.com/pytorch/pytorch/pull/46855
+                                  /*keep_graph=*/$(bool keepGraph),
+                                  /*create_graph=*/$(bool createGraph),
+                                  /*accumulate_grad=*/$(bool accumulateGrad), // https://github.com/pytorch/pytorch/pull/46855
                                                              // https://github.com/pytorch/pytorch/issues/46373
                                   output_edges);
 
