0
我正在嘗試使用tflearn,受this紙張啓發的正弦函數的一種可笑的簡單逼近。用tflearn逼近正弦函數
import tflearn
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# generate cosine function
x = np.linspace(-np.pi,np.pi,10000)
y = np.sin(x)
# Network building
net = tflearn.input_data(shape=[10,10000])
net = tflearn.fully_connected(net, 1000)
net = tflearn.layers.core.activation (net, activation='relu')
net = tflearn.regression(net)
# Define model
model = tflearn.DNN(net)
# Start training (apply gradient descent algorithm)
model.fit(x, y,batch_size=10)
,但我一直運行到一個
ValueError: Cannot feed value of shape (10,) for Tensor u'InputData/X:0', which has shape '(?, 10, 10000)'
錯誤。
關於我要去哪裏的任何想法都是錯誤的?
謝謝!
如果您在網絡建設的第一行切換10和10000,會發生什麼情況? – kpie
完全一樣的錯誤恐怕 – hdhdhdhdhdh
將'np.linspace(-np.pi,np.pi,10000)'改爲'np.linspace(-np.pi,np.pi,10000).reshape(-1 ,1)' – lejlot