MCPcopy Create free account
hub / github.com/apache/tvm / np_bf162np_float

Function np_bf162np_float

tests/python/codegen/test_target_codegen_cuda.py:125–129  ·  view source on GitHub ↗

Convert a numpy array of bf16 (uint16) to a numpy array of float

(arr)

Source from the content-addressed store, hash-verified

123 return np.right_shift(orig + bias, 16).astype("uint16")
124
125 def np_bf162np_float(arr):
126 """Convert a numpy array of bf16 (uint16) to a numpy array
127 of float"""
128 u32 = np.left_shift(arr.astype("uint32"), 16)
129 return u32.view("<f4")
130
131 def check_cuda(n, lanes):
132 vec_dtype = f"bfloat16x{lanes}"

Callers 1

check_cudaFunction · 0.85

Calls 2

astypeMethod · 0.45
viewMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…