bove) are discarded for [ ` torch.autograd.backward()  `
](../autograd.html#torch.autograd.backward "torch.autograd.backward") on a
complex scalar (e.g., this is equivalent to dropping the imaginary part of the
loss before performing a backwards).

For any other desired behavior, you can specify the covector  grad_output  in
[ ` torch.autograd.backward()  ` ](../autograd.html#torch.autograd.backward
"torch.autograd.backward") call accordingly.

####  **How are the JVP and VJP defined for cross-domain functions?** ¶

Based on formulas above and the behavior we expect to see (going from  C  →  R
2  →  C  ℂ → ℝ^2 → ℂ  C  →  R  2  →  C  should be an identity), we use the
formula given below for cross-domain functions.

The  J  V  P  JVP  J  V  P  and  V  J  P  VJP  V  J  P  for a  f  1  :  C  →
R  2  f1: ℂ → ℝ^2  f  1  :  C  →  R  2  are defined as:

> J  V  P  =  J  ∗  [  c  d  ]  JVP = J * \begin{bmatrix} c \\\ d
> \end{bmatrix}  J  V  P  =  J  ∗  [  c  d  ​  ]
>
> V  J  P  =  [  c  d  ]  ∗  J  ∗  [  1  −  1  j  ]  VJP = \begin{bmatrix} c &
> d \end{bmatrix} * J * \begin{bmatrix} 1 \\\ -1j \end{bmatrix}  V  J  P  =  [
> c  ​  d  ​  ]  ∗  J  ∗  [  1  −  1  j  ​  ]

The  J  V  P  JVP  J  V  P  and  V  J  P  VJP  V  J  P  for a  f  1  :  R  2
→  C  f1: ℝ^2 → ℂ  f  1  :  R  2  →  C  are defined as:

> J  V  P  =  [  1  1  j  ]  ∗  J  ∗  [  c  d  ]  JVP = \begin{bmatrix} 1 & 1j
> \end{bmatrix} * J * \begin{bmatrix} c \\\ d \end{bmatrix} \\\ \\\  J  V  P
> =  [  1  ​  1  j  ​  ]  ∗  J  ∗  [  c  d  ​  ]
>
> V  J  P  =  [  c  −  d  ]  ∗  J  VJP = \begin{bmatrix} c & -d \end{bmatrix}
> * J  V  J  P  =  [  c  ​  −  d  ​  ]  ∗  J

[ Next ![](../_static/images/chevron-right-orange.svg) ](broadcasting.html
"Broadcasting semantics") [ ![](../_static/images/chevron-right-orange.svg)
Previous ](amp_examples.html "Automatic Mixed Precision examples")

* * *

© Copyright 2019, Torch Contributors.

Built with [ Sphinx ](http://sphinx-doc.org/) using a [ theme
](https://github.com/rtfd/sphinx_rtd_theme) provided by [ Read the Docs
](https://readthedocs.org) .

  * Autograd mechanics 
    * Excluding subgraphs from backward 
      * ` requires_grad  `
    * How autograd encodes the history 
    * In-place operations with autograd 
      * In-place correctness checks 
    * Multithreaded Autograd 
      * Concurrency on CPU 
      * Non-determinism 
      * Graph retaining 
      * Thread Safety on Autograd Node 
      * No thread safety on C++ hooks 
      * Autograd for Complex Numbers 
        * **What notion of complex derivative does PyTorch use?**
        * **What happens if I call backward() on a complex scalar?**
        * **How are the JVP and VJP defined for cross-domain functions?**

![](https://www.googleadservices.com/pagead/conversion/795629140/?label=txkmCPmdtosBENSssfsC&guid=ON&script=0)

##  Docs

Access comprehensive developer documentation for PyTorch

[ View Docs ](https://pytorch.org/docs/stable/index.html)

##  Tutorials

Get in-depth tutorials for beginners and advanced developers

[ View Tutorials ](https://pytorch.org/tutorials)

##  Resources

Find development resources and get your questions answered

[ View Resources ](https://pytorch.org/resources)

[ ](https://pytorch.org/)

  * [ PyTorch ](https://pytorch.org/)
  * [ Get Started ](https://pytorch.org/get-started)
  * [ Features ](https://pytorch.org/features)
  * [ Ecosystem ](https://pytorch.org/ecosystem)
  * [ Blog ](https://pytorch.org/blog/)
  * [ Contributing ](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md)

  * [ Resources ](https://pytorch.org/resources)
  * [ Tutorials ](https://pytorch.org/tutorials)
  * [ Docs ](https://pytorch.org/docs/stable/index.html)
  * [ Discuss ](https://discuss.pytorch.org)
  * [ Github Issues ](https://github.com/pytorch/pytorch/issues)
  * [ Brand Guidelines ](https://pytorch.org/assets/brand-guidelines/PyTorch-Brand-Guidelines.pdf)

  * Stay Connected 
  * Email Address 

[ ](https://www.facebook.com/pytorch) [ ](