Skip to content

Int16 as data format for NDArray #2

@Superpiffer

Description

@Superpiffer

I'm trying to generate an NDArray object using a short[] array but NumSharp throws an exception:

Specified method is not supported
  at NumSharp.Backends.Unmanaged.ArraySlice.FromArray(Array arr, Boolean copy)
  at NumSharp.NDArray..ctor(Array values, Shape shape, Char order)
  [REDACTED]

For the time being I solved with something like that, but I think it's only a workaround and not a solution:

if (data.GetType() == typeof(short[]))
    data = Array.ConvertAll((short[]) data, Convert.ToInt32);

NDarray ndarray = new NDArray(data, new Shape(height, width, channels));

I navigated the code and figured out that Int16 is missing ad an accepted format. Is it a wanted behavior or a missing feature?
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions