t>      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None ,-FNQSTV] n a is a list of a s repeated n times.:kind! Replicate N3 Int'[Int, Int, Int]:kind! Replicate N5 Double)'[Double, Double, Double, Double, Double](c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone&'-134567;<=KSTV]cv}H(Helper class for automatically deriving  using GHC Generics.(Helper class for automatically deriving  using GHC Generics.(Helper class for automatically deriving  using GHC Generics.A newtype wrapper over an f a for  f that gives a free  instance (as well as  etc. instances).^Useful for performing backpropagation over functions that require some monadic context (like  ) to perform.&A newtype wrapper over an instance of  that gives a free  instance.Useful for things like  DerivingVia#, or for avoiding orphan instances.6Class of values that can be backpropagated in general.For instances of  , these methods can be given by , , and  ,. There are also generic options given in Numeric.Backprop.Class for functors,  instances, and  instances.  instance   where  =   =   =   If you leave the body of an instance declaration blank, GHC Generics will be used to derive instances if the type has a single constructor and each field is an instance of .KTo ensure that backpropagation works in a sound way, should obey the laws: identity  x ( y) = x  ( x) y = y1Also implies preservation of information, making  ()2 an illegal implementation for lists and vectors.CThis is only expected to be true up to potential "extra zeroes" in x and y in the result.  commutativity  x y =  y x  associativity  x ( y z) =  ( x y) z  idempotence    =     = sNote that not all values in the backpropagation process needs all of these methods: Only the "final result" needs , for example. These are all grouped under one typeclass for convenience in defining instances, and also to talk about sensible laws. For fine-grained control, use the "explicit" versions of library functions (for example, in Numeric.Backprop.Explicit ) instead of  based ones.(This typeclass replaces the reliance on  of the previous API (v0.1).  is strictly more powerful than h, and is a stronger constraint on types than is necessary for proper backpropagating. In particular, k is a problem for many types, preventing useful backpropagation for lists, variable-length vectors (like  Data.VectorA) and variable-size matrices from linear algebra libraries like hmatrix and  accelerate.O"Zero out" all components of a value. For scalar values, this should just be  0\. For vectors and matrices, this should set all components to zero, the additive identity.Should be idempotent:    =  Should be as lazyU as possible. This behavior is observed for all instances provided by this library.See - for a pre-built definition for instances of  and $# for a definition for instances of ). If left blank, will automatically be +, a pre-built definition for instances of   / whose fields are all themselves instances of .pAdd together two values of a type. To combine contributions of gradients, so should be information-preserving:  x ( y) = x  ( x) y = y Should be as strictU as possible. This behavior is observed for all instances provided by this library.See - for a pre-built definition for instances of  and  addFunctor# for a definition for instances of ). If left blank, will automatically be +, a pre-built definition for instances of   D with one constructor whose fields are all themselves instances of .OneE all components of a value. For scalar values, this should just be  1a. For vectors and matrices, this should set all components to one, the multiplicative identity.Should be idempotent:    =  Should be as lazyU as possible. This behavior is observed for all instances provided by this library.See  - for a pre-built definition for instances of  and '# for a definition for instances of ). If left blank, will automatically be +, a pre-built definition for instances of   / whose fields are all themselves instances of .; using GHC Generics; works if all fields are instances of .; using GHC Generics; works if all fields are instances of /, but only for values with single constructors.: using GHC Generics; works if all fields are instaces of . for instances of .Is lazy in its argument. for instances of .  for instances of .Is lazy in its argument.! for instances of ." for instances of A. Automatically pads the end of the shorter vector with zeroes.# for instances of .$ for  instances.% for instances of B. Automatically pads the end of the "shorter" value with zeroes.&i for types that are isomorphic to a list. Automatically pads the end of the "shorter" value with zeroes.' for instances of .BC adds together results;  and  act on results.DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ad and ! replace all current values, and G merges keys from both maps, adding in the case of double-occurrences.e and ! replace all current values, and G merges keys from both maps, adding in the case of double-occurrences.gk is strictl is strictm is strictn is stricto is strict, but  and  are lazy in their arguments.p is treated the same as  0 . However, , , and  preserve  if all inputs are also .qg assumes the shorter sequence has trailing zeroes, and the result has the length of the longest input.rc assumes the shorter list has trailing zeroes, and the result has the length of the longest input.sc assumes the shorter list has trailing zeroes, and the result has the length of the longest input.|}~&)convert to list (should form isomorphism)+convert from list (should form isomorphism) !"#$%&' !"#$%&'(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone &'-<QV]dh 6.Helper wrapper used for the implementation of .An  as a* describes a differentiable function from as to a.For example, a value of type  '[Int, Bool] Double is a function from an  and a , returning a '. It can be differentiated to give a gradient of an  and a & if given a total derivative for the Double. If we call  2), then, mathematically, it is akin to a:2 f : \mathbb{Z} \times 2 \rightarrow \mathbb{R} See , , and % for examples on how to run it, and ! for instructions on creating it.NIt is simpler to not use this type constructor directly, and instead use the , , , and  helper smart constructors.See Numeric.Backprop.Op#prod for a mini-tutorial on using  and  .To use an  with the backprop library, see liftOp, liftOp1, liftOp2, and liftOp3. Construct an  by giving a function creating the result, and also a continuation on how to create the gradient, given the total derivative of a.!See the module documentation for Numeric.Backprop.Op= for more details on the function that this constructor and  expect.Run the function that the \ encodes, returning a continuation to compute the gradient, given the total derivative of a. See documentation for Numeric.Backprop.Op for more information. A version of  taking explicit <, indicating the number of inputs expected and their types.Requiring an explicit  is mostly useful for rare "extremely polymorphic" situations, where GHC can't infer the type and length of the the expected input tuple. If you ever actually explicitly write down as5 as a list of types, you should be able to just use .Compose s together, like  for functions, or liftAN.That is, given an  as b1, an  as b2 , and an  as b3, it can compose them with an  '[b1,b2,b3] c to create an  as c. A version of  taking explicit <, indicating the number of inputs expected and their types.Requiring an explicit  is mostly useful for rare "extremely polymorphic" situations, where GHC can't infer the type and length of the the expected input tuple. If you ever actually explicitly write down as5 as a list of types, you should be able to just use .Convenient wrapper over J for the case where the second function only takes one input, so the two ,s can be directly piped together, like for .'Convenient infix synonym for (flipped) . Meant to be used just like : f ::  '[b] c g ::  '[a,a] b f  g :: Op '[a, a] c Run the function that an  encodes, to get the result.runOp (op2 (*)) (3 ::< 5 ::< )15Run the function that an X encodes, to get the resulting output and also its gradient with respect to the inputs.!gradOp' (op2 (*)) (3 ::< 5 ::< )(15, 5 ::< 3 ::< )"Get the gradient function that an N encodes, with a third argument expecting the total derivative of the result.!See the module documentaiton for Numeric.Backprop.Op for more information.Run the function that an I encodes, and get the gradient of the output with respect to the inputs. gradOp (op2 (*)) (3 ::< 5 ::< ) 5 ::< 3 ::< -- the gradient of x*y is (y, x)  o xs =  o xs 1 An X that coerces an item into another item whose type has the same runtime representation.4gradOp' opCoerce (Identity 5) :: (Int, Identity Int)(5, Identity 1)  =  coerced   Create an * with no gradient. Can be evaluated with C, but will throw a runtime exception when asked for the gradient.Can be used with BVar with liftOp1, and evalBP will work fine. gradBP and backprop will also work fine if the result is never used in the final answer, but will throw a runtime exception if the final answer depends on the result of this operation.+Useful if your only API is exposed through backprop. Just be sure to tell your users that this will explode when finding the gradient if the result is used in the final result. Create an * with no gradient. Can be evaluated with C, but will throw a runtime exception when asked for the gradient.Can be used with BVar with liftOp, and evalBP will work fine. gradBP and backprop will also work fine if the result is never used in the final answer, but will throw a runtime exception if the final answer depends on the result of this operation.+Useful if your only API is exposed through backprop. Just be sure to tell your users that this will explode when finding the gradient if the result is used in the final result.An A that just returns whatever it receives. The identity function.  =    An  that takes as% and returns exactly the input tuple.#gradOp' opTup (1 ::< 2 ::< 3 ::< )*(1 ::< 2 ::< 3 ::< , 1 ::< 1 ::< 1 ::< )An 2 that runs the input value through an isomorphism.xWarning: This is unsafe! It assumes that the isomorphisms themselves have derivative 1, so will break for things like  & <. Basically, don't use this for any "numeric" isomorphisms.An d that runs the two input values through an isomorphism. Useful for things like constructors. See  for caveats.An e that runs the three input values through an isomorphism. Useful for things like constructors. See  for caveats.An _ that runs the input value through an isomorphism between a tuple of values and a value. See  for caveats.In Numeric.Backprop.Op0 since version 0.1.2.0, but only exported from Numeric.Backprop since version 0.1.3.0.An 3 that extracts a value from an input value using a .Warning: This is unsafe! It assumes that it extracts a specific value unchanged, with derivative 1, so will break for things that numerically manipulate things before returning them. A version of  taking explicit 3, indicating the number of inputs and their types.Requiring an explicit  is mostly useful for rare "extremely polymorphic" situations, where GHC can't infer the type and length of the the expected input tuple. If you ever actually explicitly write down as5 as a list of types, you should be able to just use .An D that ignores all of its inputs and returns a given constant value.*gradOp' (opConst 10) (1 ::< 2 ::< 3 ::< )(10, 0 ::< 0 ::< 0 ::< ) Create an : that takes no inputs and always returns the given value.'There is no gradient, of course (using Q will give you an empty tuple), because there is no input to have a gradient of.runOp (op0 10) (10, )For a constant & that takes input and ignores it, see  and . Create an  of a function taking one input, by giving its explicit derivative. The function should return a tuple containing the result of the function, and also a function taking the derivative of the result and return the derivative of the input. If we haveT \eqalign{ f &: \mathbb{R} \rightarrow \mathbb{R}\cr y &= f(x)\cr z &= g(y) } Then the derivative  \frac{dz}{dx} , it would be:/ \frac{dz}{dx} = \frac{dz}{dy} \frac{dy}{dx} If our  represents fO, then the second item in the resulting tuple should be a function that takes  \frac{dz}{dy} and returns  \frac{dz}{dx}.As an example, here is an  that squares its input: square :: Num a =>  '[a] a square = 6 $ \x -> (x*x, \d -> 2 * d * x ) ARemember that, generally, end users shouldn't directly construct Ds; they should be provided by libraries or generated automatically. Create an  of a function taking two inputs, by giving its explicit gradient. The function should return a tuple containing the result of the function, and also a function taking the derivative of the result and return the derivative of the input. If we haveY \eqalign{ f &: \mathbb{R}^2 \rightarrow \mathbb{R}\cr z &= f(x, y)\cr k &= g(z) } Then the gradient M \left< \frac{\partial k}{\partial x}, \frac{\partial k}{\partial y} \right>  would be: \left< \frac{\partial k}{\partial x}, \frac{\partial k}{\partial y} \right> = \left< \frac{dk}{dz} \frac{\partial z}{dx}, \frac{dk}{dz} \frac{\partial z}{dy} \right> If our  represents fO, then the second item in the resulting tuple should be a function that takes  \frac{dk}{dz} and returns = \left< \frac{\partial k}{dx}, \frac{\partial k}{dx} \right> .As an example, here is an  that multiplies its inputs: mul :: Num a =>  '[a, a] a mul = op2'9 $ \x y -> (x*y, \d -> (d*y, x*d) ) ARemember that, generally, end users shouldn't directly construct Ds; they should be provided by libraries or generated automatically. Create an ] of a function taking three inputs, by giving its explicit gradient. See documentation for  for more details. for addition for subtraction for multiplication for division for exponentiation for negation for  for absolute value for multiplicative inverse for  for the natural logarithm for square root for  for sine for cosine for tangent for arcsine for arccosine for arctangent for hyperbolic sine for hyperbolic cosine for hyperbolic tangent for hyperbolic arcsine for hyperbolic arccosine for hyperbolic arctangent of  s taking as and returning different b in bsOpM taking eac of the bs from the input . Composed  of  s taking as and returning different b in bs taking eac of the bs from the input . Composed  to runInputs to run it with#The total derivative of the result. The gradientA A 9  (c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone"#%&',-016<FNQSTVchX qAn ephemeral Wengert Tape in the environment. Used internally to track of the computational graph of variables.'For the end user, one can just imagine  s  as a required constraint on s% that allows backpropagation to work.A  s a is a value of type a that can be "backpropagated".Functions referring to is are tracked by the library and can be automatically differentiated to get their gradients and results.+For simple numeric values, you can use its , , and J instances to manipulate them as if they were the numbers they represent.If aJ contains items, the items can be accessed and extracted using lenses. A  b a can be used to access an a inside a b , using ^^. ( ): () :: a ->  a b -> b (^^.) ::  s a ->  a b ->  s b There is also ^^? ( ), to use a Prism' or ] to extract a target that may or may not be present (which can implement pattern matching), ^^.. ( ) to use a  to extract all targets inside a , and .~~ (%) to set and update values inside a .GIf you have control over your data type definitions, you can also use  and @ to manipulate data types by easily extracting fields out of a  of data types and creating s of data types out of s of their fields. See Numeric.Backprop#hkd$ for a tutorial on this use pattern.@For more complex operations, libraries can provide functions on  s using  and related functions. This is how you can create primitive functions that users can use to manipulate your library's values. See  Lhttps://github.com/mstksg/backprop/wiki/Equipping-your-Library-with-Backprop for a detailed guide.For example, the hmatrix7 library has a matrix-vector multiplication function, #> :: L m n -> R n -> L m.+A library could instead provide a function #> :: % (L m n) -> BVar (R n) -> BVar (R m)3, which the user can then use to manipulate their s of L m ns and R ns, etc.See Numeric.Backprop#liftops and documentation for  for more information.OneE all components of a value. For scalar values, this should just be  1a. For vectors and matrices, this should set all components to one, the multiplicative identity.XShould be idempotent: Applying the function twice is the same as applying it just once.'Each type should ideally only have one 8. This coherence constraint is given by the typeclass .xAdd together two values of a type. To combine contributions of gradients, so should ideally be information-preserving. See laws for  for the laws this should be expected to preserve. Namely, it should be commutative and associative, with an identity for a valid .'Each type should ideally only have one 8. This coherence constraint is given by the typeclass .O"Zero out" all components of a value. For scalar values, this should just be  0\. For vectors and matrices, this should set all components to zero, the additive identity.XShould be idempotent: Applying the function twice is the same as applying it just once.'Each type should ideally only have one 8. This coherence constraint is given by the typeclass .If a type has a ! instance, this is the canonical .If a type has a ! instance, this is the canonical .If a type has a ! instance, this is the canonical .$Project out a constant value if the  refers to one.Debugging string for an .Debugging string for a  SomeTapeMode.Lift a value into a  representing a constant value.ZThis value will not be considered an input, and its gradients will not be backpropagated., but with explicit  and ., but with explicit  and ., but with explicit  and ., but with explicit  and . , but with explicit  and ., but with explicit  and ., but with explicit  and ., but with explicit  and ., but with explicit  and ., but with explicit  and . Coerce a 4 contents. Useful for things like newtype wrappers., but with explicit  and .evalBPL generalized to multiple inputs of different types. See documentation for  for more details.The canonical  for instances of .The canonical  for instances of .The canonical  for instances of .Compares the values inside the .Compares the values inside the .*This will force the value inside, as well.valone! (c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone&'-;<=>?AQSTV]cdh7Helper class for generically "splitting" and "joining" s into constructors. See  and .See Numeric.Backprop#hkd# for a tutorial on how to use this.eInstances should be available for types made with one constructor whose fields are all instances of  , with a  instance.*Helper method for generically "splitting"  s out of constructors inside a . See .(Helper method for generically "joining" s inside a constructor into a . See .6s for every item in a type level list based on their  instances for instances of 6s for every item in a type level list based on their  instances6s for every item in a type level list based on their  instances for instances of  Generate an H for every type in a type-level list, if every type has an instance of . Generate an H for every type in a type-level list, if every type has an instance of . Generate an H for every type in a type-level list, if every type has an instance of .Shorter alias for , inspired by the ad library., but with explicit ., but with explicit  and ., but with explicit .G but with no arguments. Useful when everything is just given through .Turn a function  s a ->  s b into the function a -> b that it represents.UBenchmarks show that this should have virtually no overhead over directly writing a a -> b. C is, in this situation, a zero-cost abstraction, performance-wise.See documentation of  for more information., but with explicit  and ., Nbut with explicit  and ., but with explicit  and ., but with explicit .$ for a two-argument function. See  for notes. $ for a two-argument function. See  for notes.   with explicit  and . ! with explicit  and . " with explicit  and . # with explicit  and . with explicit  and . with explicit  and .EThis instance is possible but it is not clear when it would be useful;Gradient of final result with respect to output of function;Gradient of final result with respect to output of function;Gradient of final result with respect to output of function of value s of fields s of fields of combined valuec      f        (c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone&'-<QVd+ , but with  constraints instead of Backprop constraints.The    asA in the constraint says that every value in the type-level list as must have a * instance. This means you can use, say, '[Double, Float, Int] , but not '[Double, Bool, String].If you stick to  concereteh, monomorphic usage of this (with specific types, typed into source code, known at compile-time), then    as# should be fulfilled automatically. , but with  constraints instead of Backprop constraints.See  for information on the   constraint. , but with  constraints instead of Backprop constraints.See module documentation for Numeric.Backprop.Num, for information on using this with tuples. , but with  constraints instead of Backprop constraints.See module documentation for Numeric.Backprop.Num, for information on using this with tuples. , but with  constraints instead of Backprop constraints.$ , but with  constraints instead of Backprop constraints. , but with  constraints instead of Backprop constraints. , but with  constraints instead of Backprop constraints.% , but with  constraints instead of Backprop constraints.& , but with  constraints instead of Backprop constraints.   , but with  constraints instead of Backprop constraints.!' , but with  constraints instead of Backprop constraints." , but with  constraints instead of Backprop constraints.#( , but with  constraints instead of Backprop constraints.5Note that many automatically-generated prisms by the lens\ package use tuples, which cannot work this this by default (because tuples do not have a  instance).}If you are writing an application or don't have to worry about orphan instances, you can pull in the orphan instances from  0https://hackage.haskell.org/package/NumInstances NumInstancesp. Alternatively, you can chain those prisms with conversions to the anonymous canonical strict tuple types in Numeric.Backprop.Tuple, which do have  instances. myPrism :: Prism' c (a, b) myPrism . iso tupT2 t2Tup :: Prism' c (T2 a b) $) , but with  constraints instead of Backprop constraints.Like ), is *UNSAFE*.% , but with  constraints instead of Backprop constraints.See documentation for #* for more information and important notes.&* , but with  constraints instead of Backprop constraints.' , but with  constraints instead of Backprop constraints.( , but with  constraints instead of Backprop constraints.) , but with  constraints instead of Backprop constraints.6If you are using a list or vector, I recommend using  0https://hackage.haskell.org/package/vector-sized vector-sizedC instead: it's a fixed-length vector type with a very appropriate  instance!* , but with  constraints instead of Backprop constraints.+ , but with  constraints instead of Backprop constraints., , but with  constraints instead of Backprop constraints.- , but with  constraints instead of Backprop constraints..  , but with  constraints instead of Backprop constraints./  , but with  constraints instead of Backprop constraints.0" , but with  constraints instead of Backprop constraints.1# , but with  constraints instead of Backprop constraints.;Gradient of final result with respect to output of function;Gradient of final result with respect to output of function;Gradient of final result with respect to output of functionD  !"#$%&'()*+,-./01D !#&$ "()%'./01*+,-  8!8(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone %&'-<QVdn 23Useful pattern for constructing and deconstructing s three-tuples.33Useful pattern for constructing and deconstructing s of two-tuples.46> generalized to multiple inputs of different types. See the Numeric.Backprop.Op#prod, for a mini-tutorial on heterogeneous lists.Not strictly necessary, because you can always uncurry a function by passing in all of the inputs in a data type containing all of the arguments or a giant tuple. However, this could potentially also be more performant.A  ( s) '[Double, Float, Double], for instance, is a tuple of  s ,  s , and  s ', and can be pattern matched on using  (cons) and '' (nil).1Tuples can be built and pattern matched on using  (cons) and '' (nil), as well.The    asA in the constraint says that every value in the type-level list as must have a * instance. This means you can use, say, '[Double, Float, Int] , but not '[Double, Bool, String].If you stick to  concereteh, monomorphic usage of this (with specific types, typed into source code, known at compile-time), then    as# should be fulfilled automatically.54r, but allows you to provide the gradient of the "final result" with respect to the output of your function. See 7 for more details.6Turn a function  s a ->  s b into the function a -> b2 that it represents, also computing its gradient a as well.The Rank-N type  forall s.  s  => ... is used to ensure that @s do not leak out of the context (similar to how it is used in Control.Monad.ST_), and also as a reference to an ephemeral Wengert tape used to track the graph of references.7 A version of 6o that allows you to specify the gradent of your "final result" in with respect to the output of your function.OTypically, this is just the scalar 1, or a value of components that are all 1.Instead of taking the b! gradient, the you may provide a b -> b , which 7 calls with the result of your function as the argument. This allows you to return something with the correct "shape", if not a scalar.6 is essentially 7 with  1 for scalars and  instances.8Take a function  s a ->  s b, interpreted as a function a -> b5, and compute its gradient with respect to its input.The resulting a -> a tells how the input (and its components) affects the output. Positive numbers indicate that the result will vary in the same direction as any adjustment in the input. Negative numbers indicate that the result will vary in the opposite direction as any adjustment in the input. Larger numbers indicate a greater sensitivity of change, and small numbers indicate lower sensitivity.See documentation of 6 for more information.FIf you want to provide an explicit "final gradient" for the end, see 7.98L generalized to multiple inputs of different types. See documentation for 4 for more details.:6 for a two-argument function.Not strictly necessary, because you can always uncurry a function by passing in all of the argument inside a data type, or just use a tuple. However, this could potentially be more performant.)For 3 and more arguments, consider using 4.;:r, but allows you to provide the gradient of the "final result" with respect to the output of your function. See 7 for more details.<8# for a two-argument function. See : for notes.=An infix version of >, meant to evoke parallels to  from lens.KWith normal values, you can extract something from that value with a lens: x  myLens would extract a piece of x :: b, specified by  myLens ::  b a. The result has type a. xVar = myLens would extract a piece out of xVar ::  s b (a  holding a b), specified by myLens :: Lens' b a. The result has type  s a (a  holding a a)-This is the main way to pull out values from  of container types.CIf you have control of your data type definitions, consider using P, which lets you break out s of values into Es of their individual fields automatically without requiring lenses.WARNINGO: Do not use with any lenses that operate "numerically" on the contents (like  multiplying).>Using a , extract a value inside a  . Meant to evoke parallels to view from lens.CIf you have control of your data type definitions, consider using P, which lets you break out s of values into Es of their individual fields automatically without requiring lenses.See documentation for = for more information.?An infix version of @, meant to evoke parallels to  from lens.JWith normal values, you can set something in a value with a lens: a lens: x  myLens  y would "set" a part of x :: b, specified by  myLens ::  a b, to a new value y :: a. xVar  myLens ? yVar would "set" a part of xVar ::  s b (a  holding a b), specified by  myLens ::  a b, to a new value given by  yVar ::  s a/. The result is a new (updated) value of type  s b.*This is the main way to set values inside s of container types.@Using a , set a value inside a 0. Meant to evoke parallels to "set" from lens.See documentation for ? for more information.AAn infix version of C, meant to evoke parallels to  from lens.YWith normal values, you can (potentially) extract something from that value with a lens: x  myPrism 'would (potentially) extract a piece of x :: b, specified by  myPrism ::  b a. The result has type  a. xVar A myPrism +would (potentially) extract a piece out of xVar ::  s b (a  holding a b), specified by myPrism :: Prism' b a. The result has type  ( s a) ( a  holding a a).!This is intended to be used with Prism'@s (which hits at most one target), but will actually work with any W. If the traversal hits more than one target, the first one found will be extracted.'This can be used to "pattern match" on $s, by using prisms on constructors.BAn *UNSAFE* version of C assuming that it is there.Is undefined if the  hits no targets.Is essentially A with , or D with .CUsing a , extract a single value inside a k, if it exists. If more than one traversal target exists, returns te first. Meant to evoke parallels to preview2 from lens. Really only intended to be used wth Prism'"s, or up-to-one target traversals.See documentation for A for more information.DAn infix version of E, meant to evoke parallels to  from lens.5With normal values, you can extract all targets of a  from that value with a: x  myTraversal $would extract all targets inside of x :: b, specified by myTraversal ::  b a. The result has type [a]. xVar D myTraversal $would extract all targets inside of xVar ::  s b (a  holding a b), specified by myTraversal :: Traversal' b a. The result has type [ s a] (A list of  s holding as).EUsing a , extract all targeted values inside a . Meant to evoke parallels to  from lens.See documentation for D for more information.FExtract all of the  s out of a  container of s.Note that this associates gradients in order of occurrence in the original data structure; the second item in the gradient is assumed to correspond with the second item in the input, etc.; this can cause unexpected behavior in 4 instances that don't have a fixed number of items.GCollect all of the s in a container into a  of that container's contents.Note that this associates gradients in order of occurrence in the original data structure; the second item in the total derivative and gradient is assumed to correspond with the second item in the input, etc.; this can cause unexpected behavior in 4 instances that don't have a fixed number of items.HLift an P with an arbitrary number of inputs to a function on the appropriate number of s.AShould preferably be used only by libraries to provide primitive & functions for their types for users.See Numeric.Backprop#liftops and documentation for H for more information, and Numeric.Backprop.Op#prod for a mini-tutorial on using  and  .ILift an 2 with a single input to be a function on a single .AShould preferably be used only by libraries to provide primitive & functions for their types for users.See Numeric.Backprop#liftops and documentation for H for more information.JLift an + with two inputs to be a function on a two s.AShould preferably be used only by libraries to provide primitive & functions for their types for users.See Numeric.Backprop#liftops and documentation for H for more information.KLift an / with three inputs to be a function on a three s.AShould preferably be used only by libraries to provide primitive & functions for their types for users.See Numeric.Backprop#liftops and documentation for H for more information.LConvert the value inside a B using a given isomorphism. Useful for things like constructors.CIf you have control of your data type definitions, consider using QN, which lets you use your data type constructors themselves to join together s as their fields.xWarning: This is unsafe! It assumes that the isomorphisms themselves have derivative 1, so will break for things like  & <. Basically, don't use this for any "numeric" isomorphisms.MConvert the values inside two Hs using a given isomorphism. Useful for things like constructors. See L for caveats.CIf you have control of your data type definitions, consider using QN, which lets you use your data type constructors themselves to join together s as their fields.N Convert the values inside three Hs using a given isomorphism. Useful for things like constructors. See L for caveats.O%Convert the values inside a tuple of Hs using a given isomorphism. Useful for things like constructors. See L for caveats.CIf you have control of your data type definitions, consider using QN, which lets you use your data type constructors themselves to join together s as their fields.P Split out a % of "higher-kinded data type", a la 9http://reasonablypolymorphic.com/blog/higher-kinded-data/Lets you take  of a value into a separate  of every field of that value.See Numeric.Backprop#hkd for a tutorial on usage.fThis will work with all data types made with a single constructor, whose fields are all instances of ,, where the type itself has an instance of . The type also must derive .Q Split out a % of "higher-kinded data type", a la 9http://reasonablypolymorphic.com/blog/higher-kinded-data/It lets you take a 2 of every field of a value, and join them into a  of that value.See Numeric.Backprop#hkd for a tutorial on usage.fThis will work with all data types made with a single constructor, whose fields are all instances of ,, where the type itself has an instance of .5;Gradient of final result with respect to output of function7;Gradient of final result with respect to output of function;;Gradient of final result with respect to output of functionP of value s of fieldsQ s of fields of combined valueS 23456789:;<=>?@ABCDEFGHIJKLMNOPQV687:<;495 =?ADB>@FGCE32LMNOHIJKPQ  =8?8(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<{R+, but taking explicit  and .S,, but taking explicit  and .T-, but taking explicit  and .U., but taking explicit  and .V/, but taking explicit  and .W0, but taking explicit  and .X1, but taking explicit  and .Y2, but taking explicit  and .Z3, but taking explicit  and .[4, but taking explicit  and .\Coerce items inside a .]5, but taking explicit  and .^6, but taking explicit  and ._., but taking explicit  and .`7, but taking explicit  and .a8, but taking explicit  and .RSTUVWXYZ[\]^_`aRTUVWY_`aXSZ[]^\(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<bLifted %. More efficient than going through o.cLifted .dLifted %. More efficient than going through o.eLifted %. More efficient than going through o.fLifted ". Undefined for situations where 9 would be undefined. More efficient than going through o.gLifted ". Undefined for situations where 9 would be undefined. More efficient than going through o.hLifted I. Lifts backpropagatable functions to be backpropagatable functions on  s.i Alias for h.jLifted I. Lifts backpropagatable functions to be backpropagatable functions on  s.kLifted 93I. Lifts backpropagatable functions to be backpropagatable functions on  s.lLifted 94I. Lifts backpropagatable functions to be backpropagatable functions on  s.mLifted conversion between two  instances.nLifted conversion between two  and  instances.oLifted version of 9: . Takes a  of a ! of items and returns a list of s for each item.3You can use this to implement "lifted" versions of  methods like , 9;, etc.; however, b, d, e, f, and g2 have more efficient implementations than simply  . o.pLifted version of 97.qLifted version of 98.\bcdefghijklmnopqbdefgjopqhicklmn\(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<r+ , but with  constraints instead of Backprop constraints.s, , but with  constraints instead of Backprop constraints.t- , but with  constraints instead of Backprop constraints.u. , but with  constraints instead of Backprop constraints.v/ , but with  constraints instead of Backprop constraints.w0 , but with  constraints instead of Backprop constraints.x1 , but with  constraints instead of Backprop constraints.y Alias for x.z2 , but with  constraints instead of Backprop constraints.{3 , but with  constraints instead of Backprop constraints.|4 , but with  constraints instead of Backprop constraints.}5 , but with  constraints instead of Backprop constraints.~6 , but with  constraints instead of Backprop constraints.: , but with  constraints instead of Backprop constraints.7 , but with  constraints instead of Backprop constraints.8 , but with  constraints instead of Backprop constraints.\rstuvwxyz{|}~rtuvwzxys{|}~\<=>?@A?@B?@C?@D?@E?@F?@G?@H?@I?JK?JL?JL?MNOPQRRSTTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   ! "          #  $ % & '()*+,-./0123$4% !"#56789:$%& '()* !"#;<$%& '()* !"#+,-./01234=56:78+,-./01>23456:78+,-./01>23456:78 ? @ A B C D E F G H I J K L M NOPQORSTUVOWXOY TUZO[\OR]OP^OR_OP`OPabcdOPeOPfghijTUkTUl?mnOopTq=OPrOstOsuvwxORyOsz{|O}~Osvvw                                  TUvOvOPvwOO[vvOoOO+OP,O-O.O/O0OP1Oo2O}O}O'backprop-0.2.2.0-D40h8wzV7QJIgdWSXdbCwVNumeric.BackpropNumeric.Backprop.OpNumeric.Backprop.ClassNumeric.Backprop.ExplicitNumeric.Backprop.NumPrelude.Backprop.ExplicitPrelude.BackpropPrelude.Backprop.NumData.Type.UtilGHCGenericNumeric.Backprop.InternalviewVar previewVar toListOfVarsplitBVjoinBVliftOpliftOp1liftOp2liftOp3setVar sequenceVar collectVar backpropN backpropWithNbackprop backpropWithgradBP backprop2 backpropWith2isoVarisoVar2isoVar3isoVarNgradBPNgradBP2^^..~~^^?^^?!^^..sumpureproductlengthminimummaximumfmaptraverseliftA2liftA3 fromIntegral realToFrac mapAccumL mapAccumRPtoListfoldl''reflection-2.1.3-5su5Zw7S2arHIiXmANayadData.ReflectionReifies/type-combinators-0.2.4.3-GpFGXknzxgIL2js64ktwi8Data.Type.Productonly_head'only:>::<:<ØProdTupleData.Type.CombinatorgetIIData.Type.IndexEveryGOneGAddGZeroABPrunABPNumBPrunNumBPBackpropzeroaddone genericZero genericAdd genericOnezeroNumaddNumoneNumzeroVecaddVeconeVec zeroFunctor addIsList addAsList oneFunctor $fMonadNumBP$fApplicativeNumBP $fNFDataNumBP $fFloatingABP$fFractionalABP$fNumABP $fMonadABP$fApplicativeABP $fNFDataABP $fGZero:.: $fGZeroM1 $fGZeroU1 $fGZeroV1 $fGZero:+: $fGZero:*: $fGAdd:.:$fGAddM1$fGAddU1$fGAddV1 $fGAdd:*: $fGOne:.:$fGOneM1$fGOneU1$fGOneV1 $fGOne:+: $fGOne:*:$fBackpropKleisli$fBackprop(->)$fBackpropCompose$fBackpropProduct $fBackpropArg$fBackpropDual$fBackpropLast$fBackpropFirst$fBackpropLast0$fBackpropFirst0$fBackpropOption$fBackpropProduct0 $fBackpropSum $fBackpropU1 $fBackpropV1 $fBackprop:*: $fBackpropM1 $fBackpropK1 $fBackpropRR $fBackpropLL$fBackpropConj$fBackpropJoin$fBackpropUncur3$fBackpropCur3$fBackpropUncur $fBackpropCur$fBackpropFlip $fBackpropC $fBackprop:.:$fBackpropComp1$fBackprop:*:0 $fBackprop:&:$fBackpropOption0$fBackpropProd$fBackpropIntMap $fBackpropMap$fBackpropVoid$fBackpropConst$fBackpropProxy $fBackpropI$fBackpropIdentity$fBackprop(,,,,)$fBackprop(,,,)$fBackprop(,,) $fBackprop(,) $fBackprop()$fBackpropMaybe $fBackpropSeq$fBackpropNonEmpty $fBackprop[]$fBackpropVector$fBackpropVector0$fBackpropVector1$fBackpropVector2$fBackpropDouble$fBackpropFloat$fBackpropComplex$fBackpropRatio$fBackpropWord64$fBackpropWord32$fBackpropWord16$fBackpropWord$fBackpropWord8$fBackpropNatural$fBackpropInteger $fBackpropInt$fGOneK1$fGAddK1 $fGZeroK1 $fBackpropABP$fBackpropNumBP $fShowNumBP $fReadNumBP $fEqNumBP $fOrdNumBP $fDataNumBP$fGenericNumBP$fFunctorNumBP$fFoldableNumBP$fTraversableNumBP $fNumNumBP$fFractionalNumBP$fFloatingNumBP $fShowABP $fReadABP$fEqABP$fOrdABP $fDataABP $fGenericABP $fFunctorABP $fFoldableABP$fTraversableABPOp runOpWith composeOp' composeOp composeOp1' composeOp1~.evalOprunOp gradOpWithgradOpopCoercenoGrad1noGradidOpopTupopIsoopIso2opIso3opIsoNopLensopConst'opConstop0op1op2op3+.-.*./.**.negateOpsignumOpabsOprecipOpexpOplogOpsqrtOp logBaseOpsinOpcosOptanOpasinOpacosOpatanOpsinhOpcoshOptanhOpasinhOpacoshOpatanhOp $fFloatingOp$fFractionalOp$fNumOpWBVarOneFuncOFrunOFAddFuncAFrunAFZeroFuncZFrunZFzfNumafNumofNumconstVar coerceVarevalBPNzeroFuncaddFunconeFuncBVGroupzfNums zfFunctorafNumsofNums ofFunctor zeroFuncsaddFuncsoneFuncsautoevalBP0evalBPevalBP2$fBVGroups::+::+:$fBVGroups::*::*:$fBVGroups[]U1U1$fBVGroups[]V1V1$fBVGroupsasM1M1$fBVGroups[]K1K1T3T2coerce<$> Replicate vecToProdvecLen zipWithPM_ zipWithPM3_zipPunzipP lengthProd listToVecDeffillProd zipVecList splitProdp1p2s1s2baseGHC.Base ApplicativeGHC.NumNumghc-prim GHC.TypesIOGHC.ExtsIsList GHC.GenericsDoubleGHC.ListzipWith+. fromIntegerconstFunctor&vector-0.12.0.1-LflPw1fguMb6as60UrZpxNData.Vector.Generic.BaseVectorNothingJustgonegaddgzeroOpContIntBoolData.Type.LengthLengthData.TraversablesequenceGHC.Primid GHC.Floatexplog(microlens-0.4.9.1-3wqsjzVxKHI2nLhceIdmENLens.Micro.TypeLens'signumlogBaseOC runOpContGHC.Real FractionalFloating Lens.Micro^. Traversal'bvConstdebugIRInpRefdebugSTN $fOrdBVar$fEqBVar $fNFDataBVar$fBackpropBVar insertNode gradRunnerRunnerR_rDelta_rInputswRef SomeTapeNodeSTN_stnZero_stnNodeTapeNodeTN _tnInputs_tnGradIR_irIx_irAddBRefBRInpBRIxBRCBV_bvRef_bvValgsplitBVgjoinBVFloat.~ Data.Function&^?Maybe Traversal Data.MaybefromJusthead^..toListOf Traversable Data.FoldableFoldableIntegralRealfoldr