úÎþáûÿ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ None ,-FNQSTV]Z 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]cw&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 ::< Ø)15§Run 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<FNQSTVch_Ò Ö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  6https://backprop.jle.im/06-equipping-your-library.html 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 ..NOTE: Prior to v0.2.3, this required an extra Þ (t a)$ input. However, after v0.2.3, the Þ is now derived from the ª instance of tV. This makes the API a little more convenient, and it enforces consistency with the Þ a1, so people can't pass in nonsense combinations.†Please submit an issue to the issue tracker if you find yourself in a situation where you need the flexibility to provide a separte Þ a and Þ (t a).í, but with explicit  and .î, but with explicit  and .ï Coerce a ×4 contents. Useful for things like newtype wrappers.ð, but with explicit  and .+Note that argument order changed in v0.2.3.ñ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.ÊËvalÌone!ÖרÙÚÛÜÝÞßàáâãÄÆäåæçèéêëìíîïðñòóô ÍÎÏÐÖÑÒÓÔÕÖרÙÚÅÛÜÝÞßàá×âãäØÙÚÛÜÝÞßà(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone&'-;<=>?AQSTV]cdhŒ(õ7Helper 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   instancesùÞ6s 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 .+Note that argument order changed in v0.2.3., but with explicit  and .+Note that argument order changed in v0.2.3., but with explicit .+Note that argument order changed in v0.2.3.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 .+Note that argument order changed in v0.2.3., but with explicit .+Note that argument order changed in v0.2.3.$ 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ÿKTakes function giving gradient of final result given the output of functionKTakes function giving gradient of final result given the output of functionKTakes function giving gradient of final result given the 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ÉY , 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.+Note that argument order changed in v0.2.3. , 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.+Note that argument order changed in v0.2.3. , 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.+Note that argument order changed in v0.2.3.% , 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.Prior to v0.2.3, required a   constraint on t a.* , 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.KTakes function giving gradient of final result given the output of functionKTakes function giving gradient of final result given the output of functionKTakes function giving gradient of final result given the output of functionD žŸ ª«¬­®¯²³´µ¶·¸¹Ö×äïñþ !"#$%&'()*+,-./01D×Öñ äþï!#&$ "()%'./01*+,-žŸ ¶µ­´·¸¹ª®¯²³«¬  8!8(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone %&'-<QVd„!2)Pattern synonym wrapping manual usage of Q and R. It is a pattern for a × s (z f) containing a z (× s)33Useful pattern for constructing and deconstructing ×s three-tuples.43Useful pattern for constructing and deconstructing ×s of two-tuples.57> 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.65r, but allows you to provide the gradient of the "final result" with respect to the output of your function. See 8 for more details.+Note that argument order changed in v0.2.3.7Turn 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.8 A version of 7o 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 8Š calls with the result of your function as the argument. This allows you to return something with the correct "shape", if not a scalar.7 is essentially 8 with © 1 for scalars and   instances.*Note that argument order changed in v0.2.39Take 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 7 for more information.FIf you want to provide an explicit "final gradient" for the end, see 8.:9L generalized to multiple inputs of different types. See documentation for 5 for more details.;7 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 5.<;r, but allows you to provide the gradient of the "final result" with respect to the output of your function. See 8 for more details.*Note that argument order changed in v0.2.3=9# 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 Q, 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 Q, 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 A, 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.AUsing a º, set a value inside a ×0. Meant to evoke parallels to "set" from lens.See documentation for @ for more information.BAn infix version of D, 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 B 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.CAn *UNSAFE* version of D assuming that it is there.Is undefined if the ì hits no targets.Is essentially B with í, or E with î.DUsing 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 B for more information.EAn infix version of F, 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 E 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).FUsing a Â, extract all targeted values inside a ×. Meant to evoke parallels to ð from lens.See documentation for E for more information.GExtract 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.HCollect 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.Prior to v0.2.3, required a  constraint on t a.ILift 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 I for more information, and Numeric.Backprop.Op#prod for a mini-tutorial on using  and  .JLift 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 I for more information.KLift 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 I for more information.LLift 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 I for more information.MConvert 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 RN, 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.NConvert the values inside two ×Hs using a given isomorphism. Useful for things like constructors. See M for caveats.CIf you have control of your data type definitions, consider using RN, which lets you use your data type constructors themselves to join together ×s as their fields.O Convert the values inside three ×Hs using a given isomorphism. Useful for things like constructors. See M for caveats.P%Convert the values inside a tuple of ×Hs using a given isomorphism. Useful for things like constructors. See M for caveats.CIf you have control of your data type definitions, consider using RN, which lets you use your data type constructors themselves to join together ×s as their fields.Q 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 £. Note that 2N is a pattern synonym version where the deconstructor is exactly a view into Q.R Assemble 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 . Note that 2@ is a pattern synonym version where the constructor is exactly R.2× s of fields× of combined value6KTakes function giving gradient of final result given the output of function8KTakes function giving gradient of final result given the output of function<KTakes function giving gradient of final result given the output of functionQ× of value× s of fieldsR× s of fields× of combined valueT žŸ ª«¬­®¯²³´µ¶·¸¹Ö×äïñõþ23456789:;<=>?@ABCDEFGHIJKLMNOPQRW×Ö798;=<5ñ:6 äþï>@BEC?AGHDF43MNOPIJKLQR2õžŸ ¶µ­´·¸¹ª®¯²³«¬  >8@8(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<ŸS+, but taking explicit  and .T,, but taking explicit  and .U-, but taking explicit  and .V., but taking explicit  and .W/, but taking explicit  and .X0, but taking explicit  and .Y1, but taking explicit  and .Z2, but taking explicit  and .[3, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (f b) parameter.\5, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (t b) and Þ (f (t b)) parameters.]6, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (f c) parameter.^7, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (f d) parameter._Coerce items inside a ×.`8, but taking explicit  and .a9, but taking explicit  and .b:, but taking explicit  and .c;, but taking explicit  and .d., but taking explicit  and .e<, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (t c) parameter.f=, but taking explicit  and .See documentation for 4< for information the API change in v0.2.3 that removed the Þ (t c) parameter.STUVWXYZ[\]^_`abcdefSUVWX\defYZ[T]^`abc_(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<ÃwgLifted ó%. More efficient than going through x.hLifted ô.iLifted õ%. More efficient than going through x.jLifted ö%. More efficient than going through x.kLifted ÷". Undefined for situations where ÷9 would be undefined. More efficient than going through x.lLifted ø". Undefined for situations where ø9 would be undefined. More efficient than going through x.mLifed ù. Essentially just x composed with a normal list ù#, and is only here for convenience.nLifed >2. Essentially just x composed with a normal list >2#, and is only here for convenience.oLifted úI. Lifts backpropagatable functions to be backpropagatable functions on ñ ªs.Prior to v0.2.3, required a  constraint on f b.p Alias for o.qLifted ûI. Lifts backpropagatable functions to be backpropagatable functions on ñ ªs.Prior to v0.2.3, required a  constraint on f (t b).rLifted >6I. Lifts backpropagatable functions to be backpropagatable functions on ñ Ÿs.Prior to v0.2.3, required a  constraint on f c.sLifted >7I. Lifts backpropagatable functions to be backpropagatable functions on ñ Ÿs.Prior to v0.2.3, required a  constraint on f d.tLifted conversion between two ü instances.uLifted conversion between two ¿ and ý instances.vLifted version of þ.wGradient should technically diverge whenever the fractional part is 0.5, but does not do this for convenience reasons.wLifted version of ÿ, defined to let you return - instances as targets, instead of only other ü s. Essentially the opposite of v.—The gradient should technically diverge whenever the fractional part of the downstream gradient is 0.5, but does not do this for convenience reasons.xLifted version of >? . 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 ù, >2, etc.; however, g, i, j, k, and l2 have more efficient implementations than simply ÷ . x.yLifted version of ><.Prior to v0.2.3, required a  constraint on t b.zLifted version of >=.Prior to v0.2.3, required a  constraint on t b._ghijklmnopqrstuvwxyzgijklqxyzmnophrstuvw_(c) Justin Le 2018BSD3 justin@jle.im experimental non-portableNone<áL{+ , 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.‚2 , but with   constraints instead of Backprop constraints.ƒ3 , but with   constraints instead of Backprop constraints.Prior to v0.2.3, required a   constraint on f b.„ Alias for ƒ.…5 , but with   constraints instead of Backprop constraints.See  0https://hackage.haskell.org/package/vector-sized vector-sized9 for a fixed-length vector type with a very appropriate   instance!Prior to v0.2.3, required a   constraint on f (t b).†6 , but with   constraints instead of Backprop constraints.Prior to v0.2.3, required a   constraint on f c.‡7 , but with   constraints instead of Backprop constraints.Prior to v0.2.3, required a   constraint on f d.ˆ8 , but with   constraints instead of Backprop constraints.‰9 , 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.Prior to v0.2.3, required a   constraint on t b.Ž= , but with   constraints instead of Backprop constraints.Prior to v0.2.3, required a   constraint on t b._{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ{}~€…ŒŽ‚ƒ„|†‡ˆ‰Š‹_@ABCDECDFCDGCDHCDICDJCDKCDLCDMCNOCNPCNPCQRSTUVVWXXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàááâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ               ! " # $ % &          '  ( ) * +,-./01234567$8% !"#9:;<=>$%& '()* !"#?@A$%& '()* !"#+,-./0123567B89:;?<=+,-./0123C56789:;?<=+,-./0123C56789:;?<= D E F G H I J K L M N O P Q R STUVTWXYZ[T\]T^ YZ_T`aTWbTUcTWdTUeTUfghiTUjTUklmnoYZpYZqCrsTtuYvBTUwTxyTxz{|}TW~Tx€T‚ƒTx„{…†{|‡ ˆ ‰ Š ‹ Œ  Ž   ‘ ’ “ ” •  – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ? ¦ §¨©YZª{…«T¬­{…®TU¯{|°T±²T`³{…´{…µTt¶T·¸T·+TU,T·-T·.T·/T·0T·1TU3Tt5T‚¹T‚ºT‚:T‚8T‚»¼'backprop-0.2.3.0-4xTgnnUpmK1AibXJBUeG1vNumeric.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^^..~~^^?^^?!^^..sumpureproductlengthminimummaximumfoldrfoldl'fmapNumeric.Backprop.ExplicitltraverseliftA2liftA3 fromIntegral realToFracround fromIntegral' mapAccumL mapAccumRPtoList'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[]K1K1BVT3T2coerce<$> 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_irAddBRefBRInpBRIxBRC_bvRef_bvValgsplitBVgjoinBVFloat.~ Data.Function&^?Maybe Traversal Data.MaybefromJusthead^..toListOf Traversable Data.FoldableFoldableIntegralRealRealFrac