|
|
|
@ -17,6 +17,7 @@ import numpy as np
|
|
|
|
|
from op_test import OpTest
|
|
|
|
|
import paddle.fluid.core as core
|
|
|
|
|
from paddle.fluid.op import Operator
|
|
|
|
|
import paddle.fluid.compat as cpt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestLookupTableOp(OpTest):
|
|
|
|
@ -71,7 +72,7 @@ class TestLookupTableOpWithTensorIdsAndPadding(TestLookupTableOpWithTensorIds):
|
|
|
|
|
flatten_idx = ids.flatten()
|
|
|
|
|
padding_idx = np.random.choice(flatten_idx, 1)[0]
|
|
|
|
|
self.outputs['Out'][np.squeeze(ids == padding_idx)] = np.zeros(31)
|
|
|
|
|
self.attrs = {'padding_idx': long(padding_idx)}
|
|
|
|
|
self.attrs = {'padding_idx': cpt.long_type(padding_idx)}
|
|
|
|
|
self.check_output()
|
|
|
|
|
|
|
|
|
|
def test_check_grad(self):
|
|
|
|
|