# tensorplay.cuda.profiler.profile

Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.profiler.profile.html

# tensorplay.cuda.profiler.profile

tensorplay.cuda.profiler.profile()[[source]](../_modules/tensorplay/cuda/profiler.html#profile)

Enable profiling.

Context Manager to enabling profile collection by the active profiling tool from CUDA backend.
.. rubric:: Example

```
>>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA)
>>> import tensorplay as tp
>>> model = tp.nn.Linear(20, 30).cuda()
>>> inputs = tp.randn(128, 20).cuda()
>>> with tp.cuda.profiler.profile():
...     model(inputs)
```
