Initializing tensorflow Variable with an array larger than 2GB

前端 未结 3 990
无人及你
无人及你 2020-12-01 04:30

I am trying to initialize a tensorflow Variable with pre-trained word2vec embeddings.

I have the following code:

import ten         


        
3条回答
  •  鱼传尺愫
    2020-12-01 05:05

    It seems like the only option is to use a placeholder. The cleanest way I can find is to initialize to a placeholder directly:

    X_init = tf.placeholder(tf.float32, shape=(3000000, 300))
    X = tf.Variable(X_init)
    # The rest of the setup...
    sess.run(tf.initialize_all_variables(), feed_dict={X_init: model.syn0})
    

提交回复
热议问题