From 8e1a4ca834875412086c3d8ca5f88ef60d7648b3 Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Sat, 7 Sep 2019 21:49:08 +0300 Subject: [PATCH] TensorShape: added as_list() --- src/TensorFlowNET.Core/Tensors/TensorShape.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/TensorFlowNET.Core/Tensors/TensorShape.cs b/src/TensorFlowNET.Core/Tensors/TensorShape.cs index 75d5ad07..1fc95927 100644 --- a/src/TensorFlowNET.Core/Tensors/TensorShape.cs +++ b/src/TensorFlowNET.Core/Tensors/TensorShape.cs @@ -151,6 +151,15 @@ namespace Tensorflow throw new NotImplementedException("merge_with"); } + /// + /// Returns a cloned array from . + /// + 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();