[Python] how to present uint16 as float16

Discussão em 'Python' iniciado por Stack, Abril 15, 2025.

  1. Stack

    Stack Membro Participativo

    I have a buffer of float16 elements in the memory.
    I read this buffer to a list but since I use np.ctypeslib I can't read it as float16. So I read it as uint16 and now I want to represent it as float16.

    Simple convert by list.astype(float16) won't help. I found this table https://gist.github.com/gregcotten/9911bda086c5850cb513b2980cca7648 and according to that table it works.

    I want to write a python function for convention unint16_as_float16 but don't know what are the rules.

    I appreciate your help.

    Continue reading...

Compartilhe esta Página