Skip to content

Commit

Permalink
add implicit from ndarray to string when rank is 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Oceania2018 committed Jan 28, 2019
1 parent aa570de commit 4d8b5bd
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ namespace NumSharp.Core
{
public partial class NDArray
{
public static implicit operator string(NDArray nd)
{
if (nd.ndim > 0)
throw new IncorrectShapeException();

return nd.Data<string>(0);
}

public static implicit operator NDArray(float d)
{
var ndArray = new NDArray(typeof(float), new int[0]);
Expand Down

0 comments on commit 4d8b5bd

Please sign in to comment.