File size: 505 Bytes
0fef070
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""Inputs for nkilib_dynamic_elementwise_add (library test): a, b ~ N(0,1) bf16, num_m_tiles = [[M/128]] int32."""
import ml_dtypes
import numpy as np

SHAPES = {"m256_h512": (256, 512), "m2048_h2048": (2048, 2048)}


def make_inputs(seed, shape_id):
    M, H = SHAPES[shape_id]
    rng = np.random.default_rng(seed)
    a = rng.standard_normal((M, H)).astype(ml_dtypes.bfloat16)
    b = rng.standard_normal((M, H)).astype(ml_dtypes.bfloat16)
    return (a, b, np.array([[M // 128]], dtype=np.int32)), {}