autodiff-dev / backend /contract /shared_subexpression.json
nhamid289's picture
Deploy autodiff ff35e9c
b9499ab verified
Raw History Blame Contribute Delete
1.08 kB
{
"description": "x*y appears twice and is one node, used by both sin and the sum",
"calls": {
"handle_set_function": {
"args": {
"expression": "x*y + sin(x*y)"
},
"result": {
"inputs": [
"x",
"y"
],
"constants": {},
"nodes": [
{
"id": "w1",
"kind": "input",
"name": "x"
},
{
"id": "w2",
"kind": "input",
"name": "y"
},
{
"id": "w3",
"kind": "op",
"op": "mul",
"args": [
"w1",
"w2"
]
},
{
"id": "w4",
"kind": "op",
"op": "sin",
"args": [
"w3"
]
},
{
"id": "w5",
"kind": "op",
"op": "add",
"args": [
"w3",
"w4"
]
}
],
"output": "w5"
}
}
}
}