cppflow icon indicating copy to clipboard operation
cppflow copied to clipboard

Support for bool datatype

Open sumsuddin opened this issue 3 years ago • 1 comments

tensor::get_data<bool>() call fails. Because internally it calls deduce_tf_type(), but here for bool type TF_BOOL is never returned because of the preceding if block

    template<typename T>
    TF_DataType deduce_tf_type() {
        // ... 
        // As std::is_same<unsigned char, uint8_t>::value is true this condition becomes true here.
        if (std::is_same<T, uint8_t>::value)
            return TF_UINT8;
        // ...
        // This if condition NEVER executes because of the condition above
        if (std::is_same<T, unsigned char>::value)
            return TF_BOOL;
        // ...

This line

Changing it to the following works for me (for inference),

        if (std::is_same<T, bool>::value)
            return TF_BOOL;

Thanks for looking into it.

sumsuddin avatar Feb 28 '22 06:02 sumsuddin

Lack of support of bool datatype is something that has been around for a long type. Should take a look to this soon.

In #208 there is a proposed solution.

serizba avatar Sep 23 '22 11:09 serizba