Browse Source

Tensor.Flatten

tags/v0.12
Oceania2018 6 years ago
parent
commit
dd1b589d21
4 changed files with 30 additions and 1 deletions
  1. +15
    -0
      src/TensorFlowNET.Core/Tensors/Tensor.Flatten.cs
  2. +6
    -1
      src/TensorFlowNET.Core/Tensors/Tensor.cs
  3. +6
    -0
      src/TensorFlowNET.Core/Tensors/TensorArray.cs
  4. +3
    -0
      src/TensorFlowNET.Core/Tensors/dtypes.cs

+ 15
- 0
src/TensorFlowNET.Core/Tensors/Tensor.Flatten.cs View File

@@ -0,0 +1,15 @@
using NumSharp;
using System;
using System.Collections.Generic;
using System.Text;

namespace Tensorflow
{
public partial class Tensor
{
public object[] Flatten()
{
return new Tensor[] { this };
}
}
}

+ 6
- 1
src/TensorFlowNET.Core/Tensors/Tensor.cs View File

@@ -39,7 +39,12 @@ namespace Tensorflow
/// Internally, TensorFlow represents tensors as n-dimensional arrays of base datatypes.
/// </summary>
[SuppressMessage("ReSharper", "ConvertToAutoProperty")]
public partial class Tensor : DisposableObject, ITensorOrOperation, _TensorLike, ITensorOrTensorArray, IPackable<Tensor>
public partial class Tensor : DisposableObject,
ITensorOrOperation,
_TensorLike,
ITensorOrTensorArray,
IPackable<Tensor>,
ICanBeFlattened
{
private readonly int _id;
private readonly Operation _op;


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

@@ -61,5 +61,11 @@ namespace Tensorflow

public Tensor read(Tensor index, string name = null)
=> _implementation.read(index, name: name);

public TensorArray write(Tensor index, Tensor value, string name = null)
=> _implementation.write(index, value, name: name);

public Tensor stack(string name = null)
=> _implementation.stack(name: name);
}
}

+ 3
- 0
src/TensorFlowNET.Core/Tensors/dtypes.cs View File

@@ -33,6 +33,9 @@ namespace Tensorflow
public static TF_DataType float32 = TF_DataType.TF_FLOAT; // is that float32?
public static TF_DataType float16 = TF_DataType.TF_HALF;
public static TF_DataType float64 = TF_DataType.TF_DOUBLE;
public static TF_DataType complex = TF_DataType.TF_COMPLEX;
public static TF_DataType complex64 = TF_DataType.TF_COMPLEX64;
public static TF_DataType complex128 = TF_DataType.TF_COMPLEX128;
public static TF_DataType variant = TF_DataType.TF_VARIANT;
public static TF_DataType resource = TF_DataType.TF_RESOURCE;



Loading…
Cancel
Save