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.

[Numpy] Division fails for differnt floating dtypes  #18353

@zheyuye

Description

@zheyuye

Description

The current mx.np.ndarray produces errors that cannot be tolerated in the face of simple division when the numerator and denominator data types have two differnt floating dtypes np.float32 and np.float64 such as

import mxnet as mx
import numpy as np
mx.npx.set_np()
numerator = mx.np.array(5.0).astype(np.float64)
denominator = mx.np.array(2.0)
numerator/denominator
>>>array(0., dtype=float64)

whereas the correct answer is obviously 2.5.

import numpy as np
numerator = np.array(5.0).astype(np.float64)
denominator = np.array(2.0)
numerator/denominator
>>>2.5

The same calculation steps are reliable under numpy, which forces us to face this problem directly.

Comments

@sxjscience

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions