Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 4dd639b

Browse files
author
Sheng Zha
committed
adjust tests
1 parent 814b9c9 commit 4dd639b

18 files changed

+34
-6
lines changed

tests/python/unittest/test_contrib_control_flow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from mxnet.attribute import AttrScope
2828
from common import with_seed
2929

30+
mx.reset_np()
3031

3132
@with_seed()
3233
def test_while_loop_simple_forward():

tests/python/unittest/test_contrib_io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
import mxnet as mx
1819
import mxnet.ndarray as nd
1920
from mxnet.gluon.data.vision.datasets import *
2021
from mxnet.gluon.data.dataloader import *
2122
from mxnet.contrib.io import *
2223
from mxnet.test_utils import *
2324

25+
mx.reset_np()
26+
2427
def test_contrib_DataLoaderIter():
2528
def test_mnist_batches(batch_size, expected, last_batch='discard'):
2629
dataset = MNIST(train=False)

tests/python/unittest/test_contrib_stes_op.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from mxnet import nd, autograd, gluon
2121
from mxnet.test_utils import default_context
2222

23+
mx.reset_np()
2324

2425
class RoundSTENET(gluon.HybridBlock):
2526
def __init__(self, w_init, **kwargs):

tests/python/unittest/test_contrib_text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
from collections import Counter
2121

2222
from common import assertRaises
23+
import mxnet as mx
2324
from mxnet import ndarray as nd
2425
from mxnet.test_utils import *
2526
from mxnet.contrib import text
2627

2728
import pytest
2829

30+
mx.reset_np()
2931

3032
def _get_test_str_of_tokens(token_delim, seq_delim):
3133
seq1 = token_delim + token_delim.join(['Life', 'is', 'great', '!']) + token_delim + seq_delim

tests/python/unittest/test_exc_handling.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from mxnet.test_utils import assert_exception, default_context, set_default_context, use_np
2626
import pytest
2727

28+
mx.reset_np()
2829

2930
@with_seed()
3031
@pytest.mark.skipif(os.environ.get('MXNET_ENGINE_TYPE') == 'NaiveEngine',

tests/python/unittest/test_gluon.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import random
3939
import tempfile
4040

41+
mx.reset_np()
42+
4143
@with_seed()
4244
def test_parameter():
4345
p = gluon.Parameter('weight', shape=(10, 10))
@@ -192,11 +194,11 @@ def __init__(self, **kwargs):
192194

193195
net = Net()
194196
lines = str(net.collect_params()).splitlines()
195-
197+
196198
assert 'dense0.weight' in lines[0]
197199
assert '(10, 5)' in lines[0]
198200
assert 'float32' in lines[0]
199-
201+
200202

201203
@with_seed()
202204
def test_collect_parameters():
@@ -1735,7 +1737,7 @@ def mon_callback(node_name, opr_name, arr):
17351737
model.add(mx.gluon.nn.AvgPool1D())
17361738
model.initialize()
17371739
model.hybridize()
1738-
check_name(model, [model[0].name + '_fwd_data', model[0].name + '_fwd_output'],
1740+
check_name(model, [model[0].name + '_fwd_data', model[0].name + '_fwd_output'],
17391741
expected_opr_names=["Pooling"], monitor_all=True)
17401742

17411743
# stack two layers and test

tests/python/unittest/test_gluon_batch_processor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from mxnet.gluon.contrib.estimator.batch_processor import BatchProcessor
3030
import pytest
3131

32+
mx.reset_np()
33+
3234
def _get_test_network():
3335
net = nn.Sequential()
3436
net.add(nn.Dense(4, activation='relu', flatten=False))

tests/python/unittest/test_gluon_contrib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from common import setup_module, with_seed, teardown_module
2929
import numpy as np
3030

31+
mx.reset_np()
3132

3233
def check_rnn_cell(cell, in_shape=(10, 50), out_shape=(10, 100), begin_state=None):
3334
inputs = [mx.sym.Variable('rnn_t%d_data'%i) for i in range(3)]

tests/python/unittest/test_gluon_data_vision.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
import numpy as np
3232

33+
mx.reset_np()
34+
3335
@with_seed()
3436
def test_to_tensor():
3537
# 3D Input

tests/python/unittest/test_gluon_estimator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from mxnet.gluon.contrib.estimator import *
2929
from mxnet.gluon.contrib.estimator.event_handler import *
3030

31+
mx.reset_np()
3132

3233
def _get_test_network(params=None):
3334
net = nn.Sequential()

0 commit comments

Comments
 (0)