# 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
            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):
    __slots__ = []
class SparseObject(object):
    __slots__ = ['vs', 'mut_add']
    def __init__(self, vs, mut_add):
        self.vs = vs
        self.mut_add = mut_add
VSpace.register(SparseObject, lambda x : x.vs)
SparseBox.register(SparseObject)
sparse_object_types = {SparseObject, SparseBox}

# -------------------- core reverse mode grads --------------------

identity_vjp = lambda argnums, *args: lambda g: g
defvjp(sparse_add, None, identity_vjp, identity_vjp)

# 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

            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):
    __slots__ = []
class SparseObject(object):
    __slots__ = ['vs', 'mut_add']
    def __init__(self, vs, mut_add):
        self.vs = vs
        self.mut_add = mut_add
VSpace.register(SparseObject, lambda x : x.vs)
SparseBox.register(SparseObject)
sparse_object_types = {SparseObject, SparseBox}

# -------------------- core reverse mode grads --------------------

identity_vjp = lambda argnums, *args: lambda g: g
defvjp(sparse_add, None, identity_vjp, identity_vjp)

defvjp(func(VSpace.add    ), None, identity_vjp, identity_vjp)