Пример #1
0
    lambda left, right: left <= right,
    "gt":
    lambda left, right: left > right,
    "ge":
    lambda left, right: left >= right,
    "pow":
    lambda left, right: np.power(left, right),
    "minimum":
    lambda left, right: np.minimum(left, right),
    "maximum":
    lambda left, right: np.maximum(left, right),
    "dot":
    lambda left, right: np.dot(left, right),
    # reduction ops
    "sum":
    lambda op_dict, left: math_cpu.sum(
        left, axis=op_dict['axis'], keepdims=True),
    "max":
    lambda op_dict, left: np.max(left, axis=op_dict['axis'], keepdims=True),
    "min":
    lambda op_dict, left: np.min(left, axis=op_dict['axis'], keepdims=True),
    "argmax":
    lambda op_dict, left: CustomNumpy.argmax(
        left, axis=op_dict['axis'], keepdims=True),
    "argmin":
    lambda op_dict, left: CustomNumpy.argmin(
        left, axis=op_dict['axis'], keepdims=True),
}


class NervanaMKL(NervanaCPU):
    """
Пример #2
0
    "add": lambda left, right: math_cpu.add(left, right),
    "sub": lambda left, right: math_cpu.sub(left, right),
    "mul": lambda left, right: math_cpu.mul(left, right),
    "div": lambda left, right: math_cpu.div(left, right),
    "eq": lambda left, right: left == right,
    "ne": lambda left, right: left != right,
    "lt": lambda left, right: left < right,
    "le": lambda left, right: left <= right,
    "gt": lambda left, right: left > right,
    "ge": lambda left, right: left >= right,
    "pow": lambda left, right: np.power(left, right),
    "minimum": lambda left, right: np.minimum(left, right),
    "maximum": lambda left, right: np.maximum(left, right),
    "dot": lambda left, right: np.dot(left, right),
    # reduction ops
    "sum": lambda op_dict, left: math_cpu.sum(left, axis=op_dict['axis'], keepdims=True),
    "max": lambda op_dict, left: np.max(left, axis=op_dict['axis'], keepdims=True),
    "min": lambda op_dict, left: np.min(left, axis=op_dict['axis'], keepdims=True),
    "argmax": lambda op_dict, left: CustomNumpy.argmax(left, axis=op_dict['axis'], keepdims=True),
    "argmin": lambda op_dict, left: CustomNumpy.argmin(left, axis=op_dict['axis'], keepdims=True),
}


class NervanaMKL(NervanaCPU):
    """
    MKL Backend
    """
    backend_name = 'mkl'

    def __init__(self,
                 rng_seed=None,