There are many cases where we would need to synthesize code to be placed in some specific context:
def train_a_nn(nn, param):
<loss_function>
Here <loss_function> has to be placed exactly inside train_a_nn and have to be aware of the lexical context surrounding it.
I tried reproducing this behavior in different ways but each have a caveat:
- Synthesizing the loss function and put in
train_a_nn: then type checking would fail because the template lexical context is different.
- Synthesizing the
train_a_nn itself: risk of losing the part we don't want to lose.
There are many cases where we would need to synthesize code to be placed in some specific context:
Here <loss_function> has to be placed exactly inside
train_a_nnand have to be aware of the lexical context surrounding it.I tried reproducing this behavior in different ways but each have a caveat:
train_a_nn: then type checking would fail because the template lexical context is different.train_a_nnitself: risk of losing the part we don't want to lose.