Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Inconsistent type conversion from numpy.ndarray to mx.ndarray #12268

Description

@sxjscience

When we create a mxnet ndarray using a numpy ndarray, the dtype will not be automatically inherited. However, if we create a mxnet ndarray based on an existing mxnet ndarray, the dtype will be inherited.

Example:

import mxnet as mx
import numpy as np
dat_np_to_mx = mx.nd.array(np.arange(10, dtype=np.int32))
dat_mx_to_mx =mx.nd.array(mx.nd.arange(10, dtype=np.int32)) 
print(dat_np_to_mx.dtype, dat_mx_to_mx.dtype)

Result:
<class 'numpy.float32'> <class 'numpy.int32'>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions