diff --git a/TensorFlow.NET.sln b/TensorFlow.NET.sln
index 3915a4cd..487be273 100644
--- a/TensorFlow.NET.sln
+++ b/TensorFlow.NET.sln
@@ -29,6 +29,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EA9A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist", "src\runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist\runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist.csproj", "{BEC7FC31-58BD-48C1-96CE-6B68570A5431}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SciSharp.TensorFlow-Gpu.Redist", "src\SciSharp.TensorFlow-Gpu.Redist\SciSharp.TensorFlow-Gpu.Redist.csproj", "{FAF0995D-88B9-444B-866F-2E9EB07D77A6}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist", "src\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj", "{E26AA660-F734-444C-A982-3F19C2AF8829}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -67,7 +71,6 @@ Global
{B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B598E5D5-BD2D-4191-8532-F2FBAC31AB81}.Release|Any CPU.Build.0 = Release|Any CPU
-<<<<<<< HEAD
{DF151A51-E9FD-41BD-B0F4-08A743755D44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF151A51-E9FD-41BD-B0F4-08A743755D44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF151A51-E9FD-41BD-B0F4-08A743755D44}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -76,12 +79,18 @@ Global
{6F6B3382-8F87-4CD9-BF87-C81D5405685A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F6B3382-8F87-4CD9-BF87-C81D5405685A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F6B3382-8F87-4CD9-BF87-C81D5405685A}.Release|Any CPU.Build.0 = Release|Any CPU
-=======
{BEC7FC31-58BD-48C1-96CE-6B68570A5431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEC7FC31-58BD-48C1-96CE-6B68570A5431}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEC7FC31-58BD-48C1-96CE-6B68570A5431}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEC7FC31-58BD-48C1-96CE-6B68570A5431}.Release|Any CPU.Build.0 = Release|Any CPU
->>>>>>> Provide the win-x64 runtime nuget for TensorFlow Gpu
+ {FAF0995D-88B9-444B-866F-2E9EB07D77A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FAF0995D-88B9-444B-866F-2E9EB07D77A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FAF0995D-88B9-444B-866F-2E9EB07D77A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FAF0995D-88B9-444B-866F-2E9EB07D77A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E26AA660-F734-444C-A982-3F19C2AF8829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E26AA660-F734-444C-A982-3F19C2AF8829}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E26AA660-F734-444C-A982-3F19C2AF8829}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E26AA660-F734-444C-A982-3F19C2AF8829}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/scripts/Copy-NativeTensorFlowLibs.ps1 b/scripts/Copy-NativeTensorFlowLibs.ps1
index b4dcf493..2e25b2bf 100644
--- a/scripts/Copy-NativeTensorFlowLibs.ps1
+++ b/scripts/Copy-NativeTensorFlowLibs.ps1
@@ -1,21 +1,149 @@
-$targetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist")
-
-$fileName = "libtensorflow-gpu-windows-x86_64-1.14.0.zip"
-$zipfile = [IO.Path]::Combine($PSScriptRoot, "..", "packages", $fileName)
-if (-not (Test-Path $zipfile -PathType Leaf)) {
- # Create the directory just in case it's actually needed...
- $path = [IO.Path]::Combine($PSScriptRoot, "..", "packages")
- New-Item -Path $path -Force -ItemType Directory
- Write-Host "Downloading libtensorflow gpu for Windows..."
+<#
+.SYNOPSIS
+ Copy the native TensorFlow library to enable the packing a nuget to make
+ them available to TensorFlow.NET
+
+.DESCRIPTION
+ The TensorFlow libraries are copied for Windows and Linux and it becomes
+ possible to bundle a meta-package containing them.
+
+.PARAMETER CpuLibraries
+ Switch indicating if the script should download the CPU or GPU version of the
+ TensorFlow libraries.
+ By default the GPU version of the libraries is downloaded.
+
+#>
+param(
+ [switch] $CpuLibraries = $false
+)
+
+function Expand-TarGzFiles {
+ <#
+ .SYNOPSIS
+ Expands the given list of files from the given archive into the given
+ target directory.
+
+ .PARAMETER Archive
+ Path to the archive that should be considered.
+
+ .PARAMETER Files
+ Files that should be extracted from the archive.
+
+ .PARAMETER TargetDirectory
+ Directory into which the files should be expanded.
+
+ #>
+ param
+ (
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $Archive,
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string []] $Files,
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $TargetDirectory
+ )
+
+ & 7z e $Archive -o"$TargetDirectory"
+ $TarArchive = Join-Path $TargetDirectory "libtensorflow.tar"
+
+ & 7z e $TarArchive $Files -o"$TargetDirectory"
+ Remove-Item $TarArchive
+}
+
+function Expand-ZipFiles {
+ <#
+ .SYNOPSIS
+ Expands the given list of files from the given archive into the given target directory.
+
+ .PARAMETER Archive
+ Path to the archive that should be considered.
+
+ .PARAMETER Files
+ Files that should be extracted from the archive.
+
+ .PARAMETER TargetDirectory
+ Directory into which the files should be expanded.
+ #>
+ param(
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $Archive,
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string []] $Files,
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $TargetDirectory
+ )
+
+ & 7z e $Archive $Files -o"$TargetDirectory"
+}
+
+function Split-ArchiveFromUrl {
+ <#
+ .SYNOPSIS
+ Extracts the archive name out of the given Url.
+
+ .PARAMETER ArchiveUrl
+ Url of the archive that will be downloaded.
+
+ #>
+ param(
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $ArchiveUrl
+ )
+
+ $uriParts = $ArchiveUrl.split("/")
+ $ArchivePath = $uriParts[$uriParts.Count - 1]
+
+ return $ArchivePath
+}
+
+function Copy-Archive {
+ <#
+ .SYNOPSIS
+ This function copies the given binary file to the given target location.
+
+ .PARAMETER ArchiveUrl
+ Url where the archive should be downloaded from.
+
+ .PARAMETER TargetDirectory
+ Target directory where the archive should be downloaded.
+#>
+ param (
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
+ [string] $ArchiveUrl,
+ [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
+ [string] $TargetDirectory
+ )
+
+ $ArchiveName = Split-ArchiveFromUrl $ArchiveUrl
+
+ $TargetPath = [IO.Path]::Combine($PSScriptRoot, "..", "packages", $ArchiveName)
+
+ if (Test-Path $TargetPath -PathType Leaf) {
+ Write-Error "$TargetPath already exists, please remove to download againg."
+ return $TargetPath
+ }
+
+ if (-not (Test-Path $TargetDirectory -PathType Container)) {
+ Write-Host "Creating missing $TargetDirectory"
+ New-Item -Path $TargetDirectory -ItemType Directory
+ }
+ Write-Host "Downloading $ArchiveUrl, this might take a while..."
$wc = New-Object System.Net.WebClient
- $wc.DownloadFile("https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.14.0.zip", $zipfile)
+ $wc.DownloadFile($ArchiveUrl, $TargetPath)
+
+ return $TargetPath
+}
+
+$LinuxGpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.14.0.tar.gz"
+$LinuxFiles = @(".\libtensorflow.tar", ".\lib\libtensorflow.so", ".\lib\libtensorflow.so.1", ".\lib\libtensorflow.so.1.14.0", `
+ ".\lib\libtensorflow_framework.so", ".\lib\libtensorflow_framework.so.1", ".\lib\libtensorflow_framework.so.1.14.0")
+$WindowsGpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.14.0.zip"
+$WindowsFiles = @("lib\tensorflow.dll")
+$PackagesDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "packages")
+
+
+if (-not $CpuLibraries) {
+ $WindowsArchive = $WindowsGpuArchive
+ $LinuxArchive = $LinuxGpuArchive
}
-$libraryName = "tensoflow.dll"
-$libraryLocation = "lib\tensorflow.dll"
-$windowsTensorFlow = Join-Path $targetDirectory $libraryName
+$Archive = Copy-Archive -ArchiveUrl $WindowsArchive -TargetDirectory $PackagesDirectory
+$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist")
+Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory
-if (-not (Test-Path $windowsTensorFlow))
-{
- & 7z e $zipfile $libraryLocation -o"$targetDirectory"
-}
\ No newline at end of file
+$Archive = Copy-Archive -ArchiveUrl $LinuxArchive -TargetDirectory $PackagesDirectory
+$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist")
+Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory
diff --git a/src/SciSharp.TensorFlow-Gpu.Redist/SciSharp.TensorFlow-Gpu.Redist.csproj b/src/SciSharp.TensorFlow-Gpu.Redist/SciSharp.TensorFlow-Gpu.Redist.csproj
new file mode 100644
index 00000000..61ea992e
--- /dev/null
+++ b/src/SciSharp.TensorFlow-Gpu.Redist/SciSharp.TensorFlow-Gpu.Redist.csproj
@@ -0,0 +1,81 @@
+
+
+
+ Library
+ netstandard2.0
+
+ win-x64;linux-x64
+ SciSharp.Tensorflow-Gpu.Redist
+
+ SciSharp.Tensorflow-Gpu.Redist
+ 1.0.0
+ SciSharp team
+ SciSharp STACK
+ https://github.com/SciSharp/TensorFlow.NET
+ git
+
+ Meta-package for GPU Tensoflow library runtime distribution.
+ Libraries can be directly downloaded from https://storage.googleapis.com/tensorflow/libtensorflow/
+
+ Apache-2.0
+
+ https://github.com/SciSharp/TensorFlow.NET
+ native;tensorflow;machine-learning;ML
+ ../../packages
+ false
+
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime.json
+ true
+ PreserveNewest
+
+
+
+
diff --git a/src/SciSharp.TensorFlow-Gpu.Redist/runtime.json b/src/SciSharp.TensorFlow-Gpu.Redist/runtime.json
new file mode 100644
index 00000000..392dc3cc
--- /dev/null
+++ b/src/SciSharp.TensorFlow-Gpu.Redist/runtime.json
@@ -0,0 +1,14 @@
+{
+ "runtimes": {
+ "linux-x64": {
+ "SciSharp.TensorFlow-Gpu.Redist": {
+ "runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist": "1.0.0"
+ }
+ },
+ "win-x64": {
+ "SciSharp.TensorFlow-Gpu.Redist": {
+ "runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist": "1.0.0"
+ }
+ }
+ }
+}
diff --git a/src/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj b/src/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj
new file mode 100644
index 00000000..d680f38a
--- /dev/null
+++ b/src/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj
@@ -0,0 +1,40 @@
+
+
+
+ Library
+ netstandard2.0
+ linux-x64
+ SciSharp.Tensorflow-Gpu.Redist
+
+ runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist
+ 1.0.0
+ SciSharp team
+ SciSharp STACK
+ https://github.com/SciSharp/TensorFlow.NET
+ git
+
+ Distribution of the Linux GPU Tensoflow library.
+ Dll can be directly downloaded from https://storage.googleapis.com/tensorflow/libtensorflow/
+
+ Apache-2.0
+
+ https://github.com/SciSharp/TensorFlow.NET
+ native;tensorflow;machine-learning;ML
+ ../../packages
+ false
+
+ false
+ false
+ false
+
+
+
+
+
+ runtimes/$(RuntimeIdentifier)/native/%(Filename)%(Extension)
+ true
+ PreserveNewest
+
+
+
+
\ No newline at end of file