本文整理汇总了Python中chainer.set_debug方法的典型用法代码示例。如果您正苦于以下问题:Python chainer.set_debug方法的具体用法?Python chainer.set_debug怎么用?Python chainer.set_debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chainer
的用法示例。
在下文中一共展示了chainer.set_debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def setUp(self):
self.original_debug = chainer.is_debug()
chainer.set_debug(True)
self.one = numpy.array([1], numpy.float32)
self.f = chainer.FunctionNode()
示例2: tearDown
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def tearDown(self):
chainer.set_debug(self.original_debug)
示例3: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def setUp(self):
self.original_debug = chainer.is_debug()
chainer.set_debug(True)
self.one = numpy.array([1], numpy.float32)
self.f = chainer.Function()
示例4: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def setUp(self):
self.x = np.array([1], np.float32)
chainer.set_debug(True)
示例5: tearDown
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def tearDown(self):
chainer.set_debug(False)
示例6: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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)
示例7: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def setUp(self):
self.default_debug = chainer.is_debug()
chainer.set_debug(True)
self.x_data = numpy.random.uniform(-1, 1, (4, 3, 2))
示例8: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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)
示例9: tearDown
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def tearDown(self):
chainer.set_debug(self.debug)
示例10: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def setUp(self):
self.default_debug = chainer.is_debug()
chainer.set_debug(True)
示例11: tearDown
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
def tearDown(self):
chainer.set_debug(self.default_debug)
示例12: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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)
示例13: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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))
示例14: setUp
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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)
示例15: check_collective_communication
# 需要导入模块: import chainer [as 别名]
# 或者: from chainer import set_debug [as 别名]
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