コード例 #1
0
    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}
コード例 #2
0
    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}
コード例 #3
0
 def op_forward(self, x):
     return gelu(x, True)
コード例 #4
0
 def op_forward(self, x):
     return gelu(x, False)