Skip to content

Protobuf encode/decode of NumPy arrays fails if they were F-ordered #63

Closed
@michaelosthege

Description

@michaelosthege

Test case:

from mcbackend.npproto.utils import ndarray_to_numpy, ndarray_from_numpy

arrC = numpy.array([
    [1,2,3],
    [4,5,6],
], order="C")
arrF = numpy.array([
    [1,2,3],
    [4,5,6],
], order="F")

assert arrC.strides != arrF.strides

numpy.testing.assert_array_equal(
    arrC,
    ndarray_to_numpy(ndarray_from_numpy(arrC)),
)
numpy.testing.assert_array_equal(
    arrF,
    ndarray_to_numpy(ndarray_from_numpy(arrF)),
)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions