Browse Source

TensorShape: added as_list()

tags/v0.12
Eli Belash 6 years ago
parent
commit
8e1a4ca834
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/TensorFlowNET.Core/Tensors/TensorShape.cs

+ 9
- 0
src/TensorFlowNET.Core/Tensors/TensorShape.cs View File

@@ -151,6 +151,15 @@ namespace Tensorflow
throw new NotImplementedException("merge_with");
}

/// <summary>
/// Returns a cloned array from <see cref="dims"/>.
/// </summary>
public int[] as_list() {
if (shape.IsEmpty)
throw new ValueError("as_list() is not defined on an unknown TensorShape.");
return (int[]) dims.Clone();
}

public override string ToString()
{
return shape.ToString();


Loading…
Cancel
Save