How to add a bool constant?

I tried to add a constant of type trt.bool by calling network.add_constant with weights of type np.bool, but I get an error message about Weights only accepting,int32,float16,float32. How should I do this? Is the only way to add the Weights with dtype float16 and then use an identity layer to convert it to bool?


Bool constants are not currently supported.

I haven’t tried the approach you suggested, but if identity layer approach doesn’t works, you can try using an IElementWiseLayer that compares each FP16 value for ElementWiseOperation::kGREATER against a 0.