anchor.diff:  [![Script](img/badge-script.svg)]({{fsdocs-source-basename}}.fsx)&emsp;
   [![Script](img/badge-notebook.svg)]({{fsdocs-source-basename}}.ipynb)
   
  -Extending DiffSharp
  -===================
  +# Extending DiffSharp
  +
   
   DiffSharp provides most of the essential operations found in tensor libraries such as [NumPy](https://numpy.org/), [PyTorch](https://pytorch.org/), and [TensorFlow](https://www.tensorflow.org/). All differentiable operations support the forward, reverse, and nested differentiation modes. 
   
  
positive.code: 
  
  (**
  General functions
  -----------------
  
  For more complicated functions, you can use the most general way of defining functions using the `cref:T:DiffSharp.UnaryOp` or `cref:T:DiffSharp.BinaryOp` types, which allow you to define the full forward and reverse mode differentiation rules. The documentation of these two types detail how they should be instantiated.
  
  
negative.code: 
  In the rare cases where you need to extend DiffSharp with a completely new differentiable operation that cannot be implemented as a composition of existing operations, you can use the provided extension API.
  
  ## Simple elementwise functions
  
  If the function you would like to implement is a simple elementwise function, you can use the `cref:T:DiffSharp.UnaryOpElementwise` or `cref:T:DiffSharp.BinaryOpElementwise` types to define your function and its derivatives. The forward, reverse, and nested differentiation rules for the function are automatically generated by the type. The documentation of these two types detail how they should be instantiated.
  
  