# Add a new compiler backend for jit.trace

**URL:** https://dev-discuss.pytorch.org/t/add-a-new-compiler-backend-for-jit-trace/1231
**Category:** torchscript
**Created:** [April 26, 2023, 2:39am UTC](https://dev-discuss.pytorch.org/t/add-a-new-compiler-backend-for-jit-trace/1231 "2023-04-26T02:39:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Fami64](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/fami64/32/1104_2.png) [@Fami64](https://dev-discuss.pytorch.org/u/Fami64)
#### Post date: [April 26, 2023, 2:39am UTC](https://dev-discuss.pytorch.org/t/add-a-new-compiler-backend-for-jit-trace/1231/1 "2023-04-26T02:39:28Z")

</div>

Hi all,

I want to add a new compiler backend to pytorch, I saw this post on registering a backend for dynamo.  
[https://dev-discuss.pytorch.org/t/registering-new-compiler-backend-in-pytorch2-0/1092](https://dev-discuss.pytorch.org/t/registering-new-compiler-backend-in-pytorch2-0/1092)

However, what should I do if I want to do the same for torch.jit.trace? I see that jit.trace does not take any device or backend input argument, but I can find examples like this in the test cases:

```auto
traced_net = torch.jit.trace(net, [torch.randn(5, 1, 28, 28, device='cuda')],inp = torch.randn(5, 1, 28, 28, device='cuda')

```

Is that how we are supposed to get a model trace for a specific backend? Does it mean that I necessarily have to define a new device for that purpose? If so, what should I include in the definition of that device if the only purpose is to use it for jit.trace?

Thank you in advance for helping me!

---

<div class="post-metadata">

### Author: ![smth](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/smth/32/3_2.png) [@smth](https://dev-discuss.pytorch.org/u/smth)
#### Post date: [May 25, 2023, 2:28pm UTC](https://dev-discuss.pytorch.org/t/add-a-new-compiler-backend-for-jit-trace/1231/2 "2023-05-25T14:28:11Z")

</div>

`jit.trace` is in deprecated territory, I don’t think its easy to specify and offload to a backend nor will be actively working on it.
