想象一下,我有大的預訓練嵌入,我可以加載爲numpy數組,例如形狀爲[3000000,200]。這個矩陣的大小是大於2GB,所以使用此代碼:在張量流圖中加載大的numpy矩陣作爲分區變量
data = np.zeros(shape=(3000000, 200))
variable = tf.get_variable(
"weigths",
[3000000, 200],
initializer=tf.constant_initializer(data))
session = tf.Session()
session.run(tf.global_variables_initializer())
我有錯誤ValueError: Cannot create a tensor proto whose content is larger than 2GB.
我可以tf.assign和佔位符加載它,但由於某些原因,我想使用這個嵌入權重的分區版本。分配和佔位符的方式已關閉,因爲分區變量不適用於分配操作:NotImplementedError: assign() has not been implemented for PartitionedVariable.
。
是否有可能做這樣的事情?
的主要目標是加載分區可變數據 – svetlovva