importunittestimportpaddle.v2.framework.create_op_creation_methodsascreationimportpaddle.v2.framework.coreascorefromop_test_utilimportOpTestMetaimportnumpyclassTestRandomOp(unittest.TestCase):deftest_random(self):scope=core.Scope(None)# Out = scope.create_var("Out")op=creation.op_creations.random(shape=[1000,1000],mean=5.0,std=1.0,seed=1701,Out="Out")foroutinop.outputs():ifscope.get_var(out)isNone:scope.create_var(out).get_tensor()tensor=scope.get_var("Y").get_tensor()op.infer_shape(scope)self.assertEqual([1000,1000],tensor.shape())ctx=core.DeviceContext.cpu_context()op.run(scope,ctx)self.assertAlmostEqual(numpy.std(tensor),1.0)self.assertAlmostEqual(numpy.mean(tensor),5.0)if__name__=='__main__':unittest.main()