Skip to content

BUG: exp and log cast float16 to float32 #13493

@toslunar

Description

@toslunar

After #13134 is merged, np.exp and np.log return float32 arrays for float16 inputs. Is the change intended? I could not find docs for it (https://www.numpy.org/devdocs/reference/generated/numpy.exp.html), while it is documented that np.sum casts ints to the default platform integer.

Reproducing code example:

import numpy as np
print(np.exp(np.array([1, 2], np.float16)).dtype)  # => float32
print(np.log(np.array([1, 2], np.float16)).dtype)  # => float32

Numpy/Python version information:

1.17.0.dev0+64b3e67 3.7.1 (default, Nov  6 2018, 21:02:07)
[Clang 10.0.0 (clang-1000.10.44.4)]

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