olic ` (  _symbolic_name_ ,
_symbolic_fn_ , _opset_version_ )  [ [source]
](_modules/torch/onnx.html#register_custom_op_symbolic) ¶

    

` torch.onnx.operators. ` ` shape_as_tensor ` (  _x_ )  [ [source]
](_modules/torch/onnx/operators.html#shape_as_tensor) ¶

    

` torch.onnx. ` ` select_model_mode_for_export ` (  _model_ , _mode_ )  [
[source]  ](_modules/torch/onnx.html#select_model_mode_for_export) ¶

    

A context manager to temporarily set the training mode of ‘model’ to ‘mode’,
resetting it when we exit the with-block. A no-op if mode is None.

In version 1.6 changed to this from set_training

` torch.onnx. ` ` is_in_onnx_export ` (  )  [ [source]
](_modules/torch/onnx.html#is_in_onnx_export) ¶

    

Check whether it’s in the middle of the ONNX export. This function returns
True in the middle of torch.onnx.export(). torch.onnx.export should be
executed with single thread.

[ Next ![](_static/images/chevron-right-orange.svg) ](optim.html
"torch.optim") [ ![](_static/images/chevron-right-orange.svg) Previous
](nn.init.html "torch.nn.init")

* * *

© 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) .

  * torch.onnx 
    * Example: End-to-end AlexNet from PyTorch to ONNX 
    * Tracing vs Scripting 
    * TorchVision support 
    * Limitations 
    * Supported operators 
    * Adding support for operators 
      * ATen operators 
      * Non-ATen operators 
      * Custom operators 
    * Operator Export Type 
      * ONNX 
      * ONNX_ATEN 
      * ONNX_ATEN_FALLBACK 
      * RAW 
      * ONNX_FALLTHROUGH 
    * Frequently Asked Questions 
    * Use external data format 
    * Training 
    * 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) [ ](https://twitter.com/pytorch) [
](https://www.youtube.com/pytorch)

To analyze traffic and optimize your experience, we serve cookies on this
site. By clicking or navigating, you agree to allow our usage of cookies. As
the current maintainers of this site, Facebook’s Cookies Policy applies. Learn
more, including about available controls: [ Cookies Policy
](https://www.facebook.com/policies/cookies/) .

![](_static/images/pytorch-x.svg)

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

  * [ Get Started ](https://pytorch.org/get-started)
  * [ Features ](https://pytorch.org/features)
  * [ Ecosystem ](https://pytorch.org/ecosystem)
  * [ Mobile ](https://pytorch.org/mobile)
  * [ PyTorch Hub ](https://pytorch.org/hub)
  * [ Blog ](https://pytorch.org/blog/)
  * [ Tutorials ](https://pytorch.org/tutorials)
  * [ Docs ](https://pytorch.org/docs/stable/index.html)
  * [ Resources ](https://pytorch.org/resources)
  * [ Github ](https://gith