-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
The proposal is to have the solver recognize that, say these two
calls are equivalent, so once you've tried the first you don't need to
try the second:
tf.multiply(tf.constant(2), tf.range(5)
tf.multiply(tf.constant(5), tf.range(2)
i.e., multiply(a,b) == multiply(b,a) and ditto for add.
Maybe a and be have to be of the same dtype however.
This is the problem I gave it (and of note is that adding constant 2 is necessary):
inputs = {
'data': [[0, 1, 1, 0, 0],
[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1]]
}
output = [[0, 3, 5, 6, 8],
[0, 2, 4, 6, 8],
[1, 3, 5, 7, 9]]
constants = [2]
And these are the solutions - of course only the first is interesting since tf-coder
is just reordering args.
Found solution: tf.add(data, tf.multiply(tf.constant(2), tf.range(5)))
Found solution: tf.add(data, tf.multiply(tf.range(5), tf.constant(2)))
Found solution: tf.add(tf.multiply(tf.constant(2), tf.range(5)), data)
Found solution: tf.add(tf.multiply(tf.range(5), tf.constant(2)), data)
Metadata
Metadata
Assignees
Labels
No labels