Convert a variable sized numpy array to Tensorflow Tensors

前端 未结 2 1006
悲哀的现实
悲哀的现实 2021-01-19 01:26

I am trying Tensorflow 2.0 alpha preview and was testing the Eager execution . My doubt is that if you have a numpy array of variable size in middle like

in         


        
相关标签:
2条回答
  • 2021-01-19 01:55

    This was happening to me in eager as well. Looking at the docs here , I ended up trying

    tf.convert_to_tensor(input, dtype=tf.float32)
    

    And that worked for me.

    0 讨论(0)
  • 2021-01-19 01:59

    It seems that the only way to work with this is to use lists of lists and then convert them to ragged tensors, since numpy doesnt support ragged arrays very well. Will Update if I find anything new

    0 讨论(0)
提交回复
热议问题