# \[RFC\] Differentiable tensor expression (Create and verify backward op automatically)

**URL:** <https://discuss.tvm.apache.org/t/rfc-differentiable-tensor-expression-create-and-verify-backward-op-automatically/7960>\
**Category:** RFC\
**Created:** [September 21, 2020, 2:15pm UTC](https://discuss.tvm.apache.org/t/rfc-differentiable-tensor-expression-create-and-verify-backward-op-automatically/7960 "2020-09-21T14:15:28Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![yzhliu](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/yzhliu/32/28_2.png) [@yzhliu](https://discuss.tvm.apache.org/u/yzhliu)\
**Post date:** [September 23, 2020, 4:49am UTC](https://discuss.tvm.apache.org/t/rfc-differentiable-tensor-expression-create-and-verify-backward-op-automatically/7960/5 "2020-09-23T04:49:25Z")

</div>

> [@wrongtest](#):
>
> If I have some common neural network structure such as resnet50 at hand, can I just use autodiff to get backward computation graph?

graph-wise I think you can refer to [relay.transform.gradient](https://github.com/apache/incubator-tvm/blob/master/python/tvm/relay/transform/transform.py#L713) and as you lower the differentiated graph, you may leverage the tensor-level autodiff ([te.gradient](https://github.com/apache/incubator-tvm/blob/master/python/tvm/te/autodiff.py#L22)). Though tensor gradients now are mostly manually written.

> [@wrongtest](#):
>
> Is there some description about common ops which can be coveraged by autodiff?

You may refer to [test cases](https://github.com/apache/incubator-tvm/blob/master/tests/python/unittest/test_te_autodiff.py)

> [@wrongtest](#):
>
> Can te.scan() be supported?

currently it is not supported.

---

_[View the full topic](https://discuss.tvm.apache.org/t/rfc-differentiable-tensor-expression-create-and-verify-backward-op-automatically/7960)._
