I mean, my first approach would’ve been to use the output (1x4), and just replace the tensor values with the x tensor values (1x1).
Update: I tried this:
(1) combining output with input
x_noleaf = x.clone() # cloning input to use as non-leaf node
x_noleaf[0] = x_noleaf[0] + y[0] - y[0]  # for simulating an interaction between the two x = x + Y - Y

this didn’t seem to do anything
(2) modifying the output
x_new = output.clone()
x_new = x_new[0][0:2]  # slicing for dropping elements
x_new.data[ix] = x_old.data[ix]
loss(x_new, x_target)

might work…