Skip to content

Commit 0315e89

Browse files
committed
extend asarray for float value, because Tensorflow.NET need this interface.
1 parent 83302ce commit 0315e89

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/NumSharp.Core/Creation/np.asarray.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ public static NDArray asarray(double[] data, int ndim = 1)
1616
return nd;
1717
}
1818

19+
public static NDArray asarray(float data)
20+
{
21+
var nd = new NDArray(typeof(float), 1);
22+
nd.Storage.Set(new float[] { data });
23+
return nd;
24+
}
25+
1926
public static NDArray asarray(float[] data, int ndim = 1)
2027
{
2128
var nd = new NDArray(typeof(float), data.Length);

0 commit comments

Comments
 (0)