import unittest

import numpy

from chainer.backends import cuda
from chainer import function
from chainer import functions
from chainer import variable

try:
    from chainer.testing import attr
    _error = attr.get_error()
except ImportError as e:
    _error = e


def is_available():
    return _error is None


def check_available():
    if _error is not None:
        raise RuntimeError('''\
{} is not available.

Reason: {}: {}'''.format(__name__, type(_error).__name__, _error))


def _func_name(func):
    if isinstance(func, function.Function):
        return func.__class__.__name__.lower()
示例#2
0
import numpy
import unittest

from chainer import cuda
from chainer import function
from chainer import functions
from chainer.testing import condition
from chainer import variable

try:
    from chainer.testing import attr
    _error = attr.get_error()
except ImportError as e:
    _error = e


def is_available():
    return _error is None


def check_available():
    if _error is not None:
        raise RuntimeError('''\
{} is not available.

Reason: {}: {}'''.format(__name__,
                         type(_error).__name__, _error))


def _func_name(func):
    if isinstance(func, function.Function):