@@ -195,12 +195,12 @@ private static void LoadNativeBackend(bool useCudaBackend, out StringBuilder? tr
195195
196196 // Path 1: F# Interactive / .NET Interactive - TorchSharp.dll is inside the NuGet cache
197197 // e.g. .../packages/torchsharp/0.106.1/lib/net6.0/TorchSharp.dll
198- var interactivePackagesDir = Path . GetFullPath ( Path . Combine ( torchsharpLoc ! , ".." , ".." , ".." , ".." ) ) ;
199- var torchsharpHome = Path . GetFullPath ( Path . Combine ( torchsharpLoc ! , ".." , ".." ) ) ;
198+ var interactivePackagesDir = Path . GetFullPath ( Path . Combine ( torchsharpLoc , ".." , ".." , ".." , ".." ) ) ;
199+ var torchsharpHome = Path . GetFullPath ( Path . Combine ( torchsharpLoc , ".." , ".." ) ) ;
200200
201201 trace . AppendLine ( $ " torchsharpLoc = { torchsharpLoc } ") ;
202202
203- if ( torchsharpLoc ! . Contains ( "torchsharp" ) && torchsharpLoc . Contains ( "lib" ) && Directory . Exists ( interactivePackagesDir ) && Directory . Exists ( torchsharpHome ) ) {
203+ if ( torchsharpLoc . Contains ( "torchsharp" ) && torchsharpLoc . Contains ( "lib" ) && Directory . Exists ( interactivePackagesDir ) && Directory . Exists ( torchsharpHome ) ) {
204204 packagesDir = interactivePackagesDir ;
205205 torchSharpVersion = NormalizeNuGetVersion ( Path . GetFileName ( torchsharpHome ) ) ;
206206 trace . AppendLine ( $ " Detected interactive scenario, packagesDir = { packagesDir } , torchSharpVersion = { torchSharpVersion } ") ;
@@ -243,7 +243,7 @@ private static void LoadNativeBackend(bool useCudaBackend, out StringBuilder? tr
243243
244244 var normalizedLibtorchPackageVersion = NormalizeNuGetVersion ( libtorchPackageVersion ) ;
245245 if ( useCudaBackend ) {
246- var consolidatedDir = Path . Combine ( torchsharpLoc ! , $ "cuda-{ cudaVersion } ") ;
246+ var consolidatedDir = Path . Combine ( torchsharpLoc , $ "cuda-{ cudaVersion } ") ;
247247
248248 trace . AppendLine ( $ " Trying dynamic load by consolidating native { cudaRootPackage } -* binaries to { consolidatedDir } ...") ;
249249
@@ -261,7 +261,7 @@ private static void LoadNativeBackend(bool useCudaBackend, out StringBuilder? tr
261261 throw new NotSupportedException ( message ) ;
262262 }
263263 } else {
264- var consolidatedDir = Path . Combine ( torchsharpLoc ! , $ "cpu") ;
264+ var consolidatedDir = Path . Combine ( torchsharpLoc , $ "cpu") ;
265265
266266 trace . AppendLine ( $ " Trying dynamic load by consolidating native { cpuRootPackage } binaries to { consolidatedDir } ...") ;
267267
0 commit comments