top | item 24290364

(no title)

bquinlan | 5 years ago

Work for Google - have never worked on Tensorflow

I tried:

  inputs = {
      'matrix': [[10, 20, 30],
                 [5, 5, 10],
                 [2, 2, 1]]
  }
  output = [[85/10, 85/20, 85/30],
            [85/5, 85/5, 85/10],
            [85/2, 85/2, 85/1]]
And got:

  tf.cast(tf.divide(tf.reduce_sum(matrix), matrix), 
          tf.float32)
But now I realize that is pretty close to one of the examples. Did anyone try something complex?

discuss

order

ghj|5 years ago

I tried giving it a problem that required matrix power and it couldn't solve it. (this was a somewhat real task where I couldn't google how to raise a matrix to a power in tf).

    # A dict mapping input variable names to input tensors.
    inputs = {
        'matrix': [[1, 1], [1, 0]],
        'vector': [[1], [0]],
    }

    # The corresponding output tensor.
    output = [[13],
              [8]]

    # A list of relevant scalar constants, if any.
    constants = [6]

    # An English description of the tensor manipulation.
    description = 'Whatever the equivalent of numpy.linalg.matrix_power is in tf. Calculates fibonacci.'
I was hoping it would at least return

    matrix @ matrix @ matrix @ matrix @ matrix @ matrix @ vector
But it just didn't find anything. (the constant for the exponent is large because smaller numbers give nonsense results)

nl|5 years ago

Yes, I tried a problem I recently posted to Stackoverflow.

It couldn't solve it - it was a broadcasting problem though.