Browse Source

EagerTensor from EagerTensor

tags/TensorFlowOpLayer
Oceania2018 4 years ago
parent
commit
8f32e831c0
7 changed files with 21 additions and 17 deletions
  1. +5
    -0
      src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs
  2. +2
    -2
      src/TensorFlowNET.Core/Graphs/Graph.cs
  3. +2
    -6
      src/TensorFlowNET.Core/Numpy/NDArray.Creation.cs
  4. +0
    -3
      src/TensorFlowNET.Core/Numpy/NDArray.cs
  5. +3
    -3
      src/TensorFlowNET.Core/Tensorflow.Binding.csproj
  6. +6
    -0
      src/TensorFlowNET.Core/ops.cs
  7. +3
    -3
      src/TensorFlowNET.Keras/Tensorflow.Keras.csproj

+ 5
- 0
src/TensorFlowNET.Core/Eager/EagerTensor.Creation.cs View File

@@ -7,6 +7,11 @@ namespace Tensorflow.Eager
{
public partial class EagerTensor
{
public EagerTensor(SafeTensorHandle handle)
{
NewEagerTensorHandle(handle);
}

public EagerTensor(SafeTensorHandleHandle handle)
{
_id = ops.uid();


+ 2
- 2
src/TensorFlowNET.Core/Graphs/Graph.cs View File

@@ -127,7 +127,7 @@ namespace Tensorflow
_nodes_by_id = new Dictionary<int, ITensorOrOperation>();
_nodes_by_name = new Dictionary<string, ITensorOrOperation>();
_names_in_use = new Dictionary<string, int>();
_graph_key = $"grap-key-{ops.uid()}/";
_graph_key = $"graph-{ops.GraphUniqueId()}/";
}

public Graph(IntPtr handle)
@@ -136,7 +136,7 @@ namespace Tensorflow
_nodes_by_id = new Dictionary<int, ITensorOrOperation>();
_nodes_by_name = new Dictionary<string, ITensorOrOperation>();
_names_in_use = new Dictionary<string, int>();
_graph_key = $"grap-key-{ops.uid()}/";
_graph_key = $"grap-{ops.GraphUniqueId()}/";
}

public ITensorOrOperation as_graph_element(object obj, bool allow_tensor = true, bool allow_operation = true)


+ 2
- 6
src/TensorFlowNET.Core/Numpy/NDArray.Creation.cs View File

@@ -56,12 +56,8 @@ namespace Tensorflow.NumPy

void NewEagerTensorHandle()
{
if(_handle is not null)
{
_id = ops.uid();
_eagerTensorHandle = c_api.TFE_NewTensorHandle(_handle, tf.Status.Handle);
tf.Status.Check(true);
}
if (_handle is not null)
_eagerTensorHandle = new EagerTensor(_handle).EagerTensorHandle;
}
}
}

+ 0
- 3
src/TensorFlowNET.Core/Numpy/NDArray.cs View File

@@ -28,9 +28,6 @@ namespace Tensorflow.NumPy
{
public IntPtr data => TensorDataPointer;

public ValueType GetValue(params int[] indices)
=> throw new NotImplementedException("");

[AutoNumPy]
public NDArray reshape(Shape newshape) => new NDArray(tf.reshape(this, newshape));
public NDArray astype(TF_DataType dtype) => new NDArray(math_ops.cast(this, dtype));


+ 3
- 3
src/TensorFlowNET.Core/Tensorflow.Binding.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>2.2.0</TargetTensorFlow>
<Version>0.60.2</Version>
<Version>0.60.3</Version>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
@@ -20,7 +20,7 @@
<Description>Google's TensorFlow full binding in .NET Standard.
Building, training and infering deep learning models.
https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.60.2.0</AssemblyVersion>
<AssemblyVersion>0.60.3.0</AssemblyVersion>
<PackageReleaseNotes>tf.net 0.60.x and above are based on tensorflow native 2.6.0

* Eager Mode is added finally.
@@ -35,7 +35,7 @@ Keras API is a separate package released as TensorFlow.Keras.
tf.net 0.4x.x aligns with TensorFlow v2.4.1 native library.
tf.net 0.5x.x aligns with TensorFlow v2.5.x native library.
tf.net 0.6x.x aligns with TensorFlow v2.6.x native library.</PackageReleaseNotes>
<FileVersion>0.60.2.0</FileVersion>
<FileVersion>0.60.3.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>


+ 6
- 0
src/TensorFlowNET.Core/ops.cs View File

@@ -366,6 +366,12 @@ namespace Tensorflow
return Interlocked.Increment(ref uid_number);
}

static int graph_uid_number = -1;
public static int GraphUniqueId()
{
return Interlocked.Increment(ref graph_uid_number);
}

static int uid_number_for_function = 0;
public static int uid_function()
=> Interlocked.Increment(ref uid_number_for_function);


+ 3
- 3
src/TensorFlowNET.Keras/Tensorflow.Keras.csproj View File

@@ -7,7 +7,7 @@
<Nullable>enable</Nullable>
<RootNamespace>Tensorflow.Keras</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
<Version>0.6.2</Version>
<Version>0.6.3</Version>
<Authors>Haiping Chen</Authors>
<Product>Keras for .NET</Product>
<Copyright>Apache 2.0, Haiping Chen 2021</Copyright>
@@ -37,8 +37,8 @@ Keras is an API designed for human beings, not machines. Keras follows best prac
<RepositoryType>Git</RepositoryType>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>0.6.2.0</AssemblyVersion>
<FileVersion>0.6.2.0</FileVersion>
<AssemblyVersion>0.6.3.0</AssemblyVersion>
<FileVersion>0.6.3.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>



Loading…
Cancel
Save