def setUp(self): self.op_type = "gelu" self.dtype = np.float32 x = np.random.uniform(-1, 1, [11, 17]).astype(self.dtype) out = gelu(x, True) self.inputs = {'X': OpTest.np_dtype_to_fluid_dtype(x)} self.outputs = {'Out': out} self.attrs = {"use_mkldnn": True, "approximate": True}
def setUp(self): self.op_type = "gelu" self.dtype = np.uint16 x = np.random.uniform(-1, 1, [2, 4, 3, 5]).astype(np.float32) out = convert_float_to_uint16(gelu(x, True)) self.inputs = {'X': convert_float_to_uint16(x)} self.outputs = {'Out': out} self.attrs = {"use_mkldnn": True, "approximate": True}
def op_forward(self, x): return gelu(x, True)
def op_forward(self, x): return gelu(x, False)