# Path: autograd/tracer.py
# def trace(start_node, fun, x):
#     def __init__(self, value, fun, args, kwargs, parent_argnums, parents):
#     def initialize_root(self, *args, **kwargs):
#     def new_root(cls, *args, **kwargs):
# def primitive(f_raw):
#     def f_wrapped(*args, **kwargs):
# def register_notrace(trace_type, primitive_fun):
# def notrace_primitive(f_raw):
#     def f_wrapped(*args, **kwargs):
# def find_top_boxed_args(args):
#     def __init__(self):
#     def new_trace(self):
#     def __init__(self, value, trace, node):
#     def __bool__(self):
#     def __str__(self):
#     def register(cls, value_type):
# def new_box(value, trace, node):
# class Node(object):
# class TraceStack(object):
# class Box(object):
# 
# Path: autograd/util.py
# def func(f): return f
# 
# def subval(x, i, v):
#     x_ = list(x)
#     x_[i] = v
#     return tuple(x_)


from itertools import count
from functools import reduce
from .tracer import trace, primitive, toposort, Node, Box, isbox, getval
from .util import func, subval
import warnings
    def _add(self, x, y):        return x + y
    def _mut_add(self, x, y):    x += y; return x
    def _scalar_mul(self, x, a): return x * a
    def _inner_prod(self, x, y): assert False
    def _covector(self, x):      return x

    def __eq__(self, other):
        return type(self) == type(other) and self.__dict__ == other.__dict__

    def __repr__(self):
        return "{}_{}".format(type(self).__name__, self.__dict__)

    @classmethod
    def register(cls, value_type, vspace_maker=None):
        if vspace_maker:
            VSpace.mappings[value_type] = vspace_maker
        else:
            VSpace.mappings[value_type] = cls

def vspace(value):
    try:
        return VSpace.mappings[type(value)](value)
    except KeyError:
        if isbox(value):
            return vspace(getval(value))
        else:
            raise TypeError("Can't find vector space for value {} of type {}. "
                            "Valid types are {}".format(
                                value, type(value), VSpace.mappings.keys()))


# Path: autograd/tracer.py
# def trace(start_node, fun, x):
#     def __init__(self, value, fun, args, kwargs, parent_argnums, parents):
#     def initialize_root(self, *args, **kwargs):
#     def new_root(cls, *args, **kwargs):
# def primitive(f_raw):
#     def f_wrapped(*args, **kwargs):
# def register_notrace(trace_type, primitive_fun):
# def notrace_primitive(f_raw):
#     def f_wrapped(*args, **kwargs):
# def find_top_boxed_args(args):
#     def __init__(self):
#     def new_trace(self):
#     def __init__(self, value, trace, node):
#     def __bool__(self):
#     def __str__(self):
#     def register(cls, value_type):
# def new_box(value, trace, node):
# class Node(object):
# class TraceStack(object):
# class Box(object):
# 
# Path: autograd/util.py
# def func(f): return f
# 
# def subval(x, i, v):
#     x_ = list(x)
#     x_[i] = v
#     return tuple(x_)


# Path: autograd/core.py
from itertools import count
from functools import reduce
from .tracer import trace, primitive, toposort, Node, Box, isbox, getval
from .util import func, subval
import warnings

    def _add(self, x, y):        return x + y
    def _mut_add(self, x, y):    x += y; return x
    def _scalar_mul(self, x, a): return x * a
    def _inner_prod(self, x, y): assert False
    def _covector(self, x):      return x

    def __eq__(self, other):
        return type(self) == type(other) and self.__dict__ == other.__dict__

    def __repr__(self):
        return "{}_{}".format(type(self).__name__, self.__dict__)

    @classmethod
    def register(cls, value_type, vspace_maker=None):
        if vspace_maker:
            VSpace.mappings[value_type] = vspace_maker
        else:
            VSpace.mappings[value_type] = cls

def vspace(value):
    try:
        return VSpace.mappings[type(value)](value)
    except KeyError:
        if isbox(value):
            return vspace(getval(value))
        else:
            raise TypeError("Can't find vector space for value {} of type {}. "
                            "Valid types are {}".format(
                                value, type(value), VSpace.mappings.keys()))


class SparseBox(Box):