In driver, runtime and nvrtc, the conversion of an argument that accepts any Python int or None, but converts to one of the fixed-size C ints in CUDA (e.g. cuuint32_t) looks like:
cdefcydriver.cuuint32_tcytensorRankiftensorRankisNone:
ptensorRank=0elifisinstance(tensorRank, (cuuint32_t,)):
ptensorRank=int(tensorRank)
else:
ptensorRank=int(cuuint32_t(tensorRank))
This can be reduced to:
cdefcydriver.cuuint32_tcytensorRankiftensorRankisNone:
ptensorRank=0else:
ptensorRank=int(tensorRank)
In driver, runtime and nvrtc, the conversion of an argument that accepts any Python
intorNone, but converts to one of the fixed-size C ints in CUDA (e.g. cuuint32_t) looks like:This can be reduced to: