Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The type conversion problem of array operations #11485

Closed
@yydcnjjw

Description

@yydcnjjw
a = np.array([0,255], dtype='uint8')
output:array([  0, 255], dtype=uint8)

a * 2
output:array([  0, 254], dtype=uint8) // become  the top eight after the operation

b = np.array([1, 255], dtype='uint8')
b * 256
output:array([  256, 65280], dtype=uint16) // Automatically become the type of uint16

The change of the variable type depends on the minimum of the array?

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