Tensorflow “map operation” for tensor?

后端 未结 3 1979
执念已碎
执念已碎 2021-01-04 01:38

I am adapting the cifar10 convolution example to my problem. I\'d like to change the data input from a design that reads images one-at-a-time from a file to a design that

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 01:57

    Tensorflow provides a couple of higher-order functions and one of them is tf.map_fn. The usage is very easy: you define your mappping and apply it to the tensor:

    variable = tf.Variable(...)
    mapping = lambda x: f(x)
    res = tf.map_fn(mapping, variable)
    

提交回复
热议问题