Python chainer.set_debug() Examples

The following are 22 code examples of chainer.set_debug(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module chainer , or try the search function .
Example #1
Source File: test_permutate.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.debug) 
Example #2
Source File: test_softmax_cross_entropy.py    From chainer-segnet with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.original_debug) 
Example #3
Source File: test_softmax_cross_entropy.py    From chainer-segnet with MIT License 5 votes vote down vote up
def setUp(self):
        self.x = numpy.random.uniform(-1, 1, (2, 2)).astype(numpy.float32)
        # `0` is required to avoid NaN
        self.t = numpy.array([self.t_value, 0], dtype=numpy.int32)
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #4
Source File: test_softmax_cross_entropy.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.original_debug) 
Example #5
Source File: test_softmax_cross_entropy.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.x = numpy.random.uniform(-1, 1, (2, 2)).astype(numpy.float32)
        # `0` is required to avoid NaN
        self.t = numpy.array([self.t_value, 0], dtype=numpy.int32)
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #6
Source File: test_scatter_add.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.default_debug) 
Example #7
Source File: test_scatter_add.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.default_debug = chainer.is_debug()
        chainer.set_debug(True)

        self.a_data = numpy.random.uniform(-1, 1, (4, 3, 2))
        self.b_data = numpy.random.uniform(-1, 1, (2, 2)) 
Example #8
Source File: test_select_item.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.x = numpy.random.uniform(-1, 1, (1, 2)).astype(numpy.float32)
        self.t = numpy.array([self.t_value], dtype=numpy.int32)
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #9
Source File: test_split_axis.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.default_debug) 
Example #10
Source File: test_split_axis.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.default_debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #11
Source File: test_function_node.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True)
        self.one = numpy.array([1], numpy.float32)
        self.f = chainer.FunctionNode() 
Example #12
Source File: test_permutate.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.x = numpy.arange(10).reshape((2, 5)).astype('f')
        self.ind = numpy.array(self.indices, 'i')
        self.debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #13
Source File: test_get_item.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.default_debug = chainer.is_debug()
        chainer.set_debug(True)

        self.x_data = numpy.random.uniform(-1, 1, (4, 3, 2)) 
Example #14
Source File: test_embed_id.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.original_debug) 
Example #15
Source File: test_embed_id.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.link = links.EmbedID(2, 2, ignore_label=self.ignore_label)
        self.t = numpy.array([self.t_value], dtype=numpy.int32)
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True) 
Example #16
Source File: test_variable.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(False) 
Example #17
Source File: test_variable.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.x = np.array([1], np.float32)
        chainer.set_debug(True) 
Example #18
Source File: test_function.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True)
        self.one = numpy.array(1, numpy.float32)
        self.f = chainer.Function() 
Example #19
Source File: test_function.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.original_debug) 
Example #20
Source File: test_function.py    From chainer with MIT License 5 votes vote down vote up
def setUp(self):
        self.original_debug = chainer.is_debug()
        chainer.set_debug(True)
        self.one = numpy.array([1], numpy.float32)
        self.f = chainer.Function() 
Example #21
Source File: test_function_node.py    From chainer with MIT License 5 votes vote down vote up
def tearDown(self):
        chainer.set_debug(self.original_debug) 
Example #22
Source File: test_communicator.py    From chainer with MIT License 4 votes vote down vote up
def check_collective_communication(param, use_gpu, use_chx):
    communicator = create_communicator(param, use_gpu, use_chx)
    mpi_comm.barrier()

    model = ExampleModel(param.model_dtype)
    if use_gpu:
        device = chainermn.testing.get_device(communicator.intra_rank, use_chx)
    else:
        device = chainermn.testing.get_device(use_chainerx=use_chx)

    model.to_device(device)
    check_bcast_data(communicator, model)

    model = ExampleModel(param.model_dtype)
    model.to_device(device)
    check_multi_node_mean_grad(communicator, model)

    model = ExampleModel(param.model_dtype)
    model.to_device(device)
    check_multi_node_mean_grad_empty(communicator, model)

    model = ExampleModel(param.model_dtype)
    model.to_device(device)
    check_multi_node_mean_grad_empty_half(communicator, model)

    # Check allreduce debug mode
    model = ExampleModel()
    model.to_device(device)
    # The example model includes some nan parameters so the debug mode
    # must detect it.
    chainer.set_debug(True)
    with pytest.raises(ValueError, match=r'.* diverged .*'):
        check_multi_node_mean_grad(communicator, model)
    chainer.set_debug(False)

    # barrier() requires before destructor of PureNcclCommunicator
    # because communication may not be finished.
    mpi_comm.barrier()
    communicator.finalize()


# chainer.testing.parameterize is not available at functions