Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
TF.NET implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakkumar1984 committed Apr 18, 2019
1 parent bf470be commit b0a27c9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Backends/SiaNet.Backend.CNTK/SiaNet.Backend.CNTK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CNTK.GPU" Version="2.6.0" />
<PackageReference Include="CNTK.GPU" Version="2.7.0-rc0.dev20190417" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CNTK.CPUOnly" Version="2.6.0" />
<PackageReference Include="CNTK.CPUOnly" Version="2.7.0-rc0.dev20190417" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="TensorFlow.NET" Version="0.6.0" />
<PackageReference Include="TensorFlow.NET" Version="0.6.1-alpha" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 12 additions & 6 deletions Backends/SiaNet.Backend.TensorFlow/SiaNetBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public SiaTensor Ceil(SiaTensor x)

public SiaTensor Round(SiaTensor x)
{
throw new NotImplementedException();
return Out(tf.round(In(x)));
}

public SiaTensor Sin(SiaTensor x)
Expand Down Expand Up @@ -393,7 +393,7 @@ public SiaTensor Tanh(SiaTensor x)

public SiaTensor Sigmoid(SiaTensor x)
{
throw new NotImplementedException();
return Out(tf.sigmoid(In(x)));
}

public SiaTensor Pow(SiaTensor x, float value)
Expand Down Expand Up @@ -461,12 +461,18 @@ public float Min(SiaTensor x)

public SiaTensor Min(SiaTensor x, int dim)
{
throw new NotImplementedException();
return Out(tf.min(In(x), dim)));
}

public SiaTensor Min(SiaTensor x, params int[] dim)
public SiaTensor Min(SiaTensor x, params int[] dims)
{
throw new NotImplementedException();
for (int i = 0; i < dims.Length; i++)
{
dims[i] = dims[i] < 0 ? x.DimCount + dims[i] : dims[i];
x = Min(x, dims[i]);
}

return x;
}

public float Mean(SiaTensor x)
Expand Down Expand Up @@ -539,7 +545,7 @@ public SiaTensor Dot(SiaTensor a, SiaTensor b)

public SiaTensor Diag(SiaTensor x)
{
throw new NotImplementedException();
return Out(tf.diag(In(x)));
}

public SiaTensor Softmax(SiaTensor x, int axis = -1)
Expand Down
4 changes: 2 additions & 2 deletions Examples/BostonHousingRegressionExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class Program
static void Main(string[] args)
{
//Setup Engine
Global.UseEngine(SiaNet.Backend.ArrayFire.SiaNetBackend.Instance, DeviceType.CPU);
Global.UseEngine(SiaNet.Backend.MxNetLib.SiaNetBackend.Instance, DeviceType.CPU);

//Load Train and Test CSV data
var ds = LoadTrain("./train.csv");

//Build Model
var model = new Sequential();
model.EpochEnd += Model_EpochEnd;
model.Add(new Dense(64, activation: ActType.ReLU));
model.Add(new Dense(128, activation: ActType.ReLU));
model.Add(new Dense(32, activation: ActType.ReLU));
model.Add(new Dense(1));

Expand Down
30 changes: 1 addition & 29 deletions SiaNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiaNet.Backend.ArrayFire",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiaNet.Engine", "SiaNet.Engine\SiaNet.Engine.csproj", "{31409A5F-8E3A-4998-81D6-D078F44EB230}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{7613D158-F93E-4912-B3D7-1D5C9B924979}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CpuOps", "Library\CpuOps\CpuOps.vcxproj", "{920E488B-9DDE-4AC0-863D-448645F9A15D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiaNet.ManagedCuda", "Library\ManagedCuda\SiaNet.ManagedCuda.csproj", "{D54D5F47-4596-49D0-8BB6-57567704E515}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BackendTester", "Examples\BackendTester\BackendTester.csproj", "{D1577671-72F4-46BF-830E-B0E31342F5C9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{7BE4048A-A308-48D3-B19E-C15ADA464BFB}"
Expand Down Expand Up @@ -66,7 +60,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "Docs\", "{4A3A0628-
SlnRelativePath = "Docs\"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiaNet.Backend.Torch", "Backends\SiaNet.Backend.Torch\SiaNet.Backend.Torch.csproj", "{837B2E45-1E0D-40C6-B6DF-4F9A366D555A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SiaNet.Backend.Torch", "Backends\SiaNet.Backend.Torch\SiaNet.Backend.Torch.csproj", "{837B2E45-1E0D-40C6-B6DF-4F9A366D555A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -114,26 +108,6 @@ Global
{31409A5F-8E3A-4998-81D6-D078F44EB230}.Release|x64.Build.0 = Release|x64
{31409A5F-8E3A-4998-81D6-D078F44EB230}.Release|x86.ActiveCfg = Release|x86
{31409A5F-8E3A-4998-81D6-D078F44EB230}.Release|x86.Build.0 = Release|x86
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Debug|x64.ActiveCfg = Debug|x64
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Debug|x86.ActiveCfg = Debug|Win32
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Debug|x86.Build.0 = Debug|Win32
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Release|Any CPU.ActiveCfg = Release|x64
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Release|x64.ActiveCfg = Release|x64
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Release|x86.ActiveCfg = Release|Win32
{920E488B-9DDE-4AC0-863D-448645F9A15D}.Release|x86.Build.0 = Release|Win32
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|x64.ActiveCfg = Debug|x64
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|x64.Build.0 = Debug|x64
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|x86.ActiveCfg = Debug|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Debug|x86.Build.0 = Debug|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|Any CPU.Build.0 = Release|Any CPU
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|x64.ActiveCfg = Release|x64
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|x64.Build.0 = Release|x64
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|x86.ActiveCfg = Release|x86
{D54D5F47-4596-49D0-8BB6-57567704E515}.Release|x86.Build.0 = Release|x86
{D1577671-72F4-46BF-830E-B0E31342F5C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1577671-72F4-46BF-830E-B0E31342F5C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1577671-72F4-46BF-830E-B0E31342F5C9}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -266,8 +240,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7ECF0701-1257-436E-A76B-01ACCF3B05AA} = {4C6F0825-E151-44F4-9BB5-01BCAF886663}
{920E488B-9DDE-4AC0-863D-448645F9A15D} = {7613D158-F93E-4912-B3D7-1D5C9B924979}
{D54D5F47-4596-49D0-8BB6-57567704E515} = {7613D158-F93E-4912-B3D7-1D5C9B924979}
{D1577671-72F4-46BF-830E-B0E31342F5C9} = {7BE4048A-A308-48D3-B19E-C15ADA464BFB}
{BEC834F0-A738-43E3-B289-0146A78E3181} = {7BE4048A-A308-48D3-B19E-C15ADA464BFB}
{293500DF-085C-4F20-9758-1F51A8608CA6} = {7BE4048A-A308-48D3-B19E-C15ADA464BFB}
Expand Down

0 comments on commit b0a27c9

Please sign in to comment.