小编Ser*_*Dev的帖子

Tensorflow:保存/恢复会话,检查点,元图

我一直在尝试恢复tensorflow中的模型,但是当我尝试导入元图时,我遇到了一些问题:

这是我导入元图的代码:

#Create a clean graph and import MetaGraphDef nodes
new_graph = tf.Graph()
with tf.Session(graph=new_graph) as sess:
    # Import the previously exported metagraph
    saver = tf.train.import_meta_graph('/tmp/saver-model.meta')
    saver.restore(sess, tf.train.latest_checkpoint('./'))
Run Code Online (Sandbox Code Playgroud)

在我的Model类中,我已经指定了占位符和集合,如下所示:

    """Place Holders"""
    self.input = tf.placeholder(tf.float32, [None, sl], name = 'input')
    self.labels = tf.placeholder(tf.int64, [None], name = 'labels')
    self.keep_prob = tf.placeholder("float", name= 'Drop_out_keep_prob')
    tf.add_to_collection('vars', self.input)
    tf.add_to_collection('vars', self.labels)
    tf.add_to_collection('vars', self.keep_prob)
Run Code Online (Sandbox Code Playgroud)

我训练我的模型如下:

saver = tf.train.Saver(tf.global_variables())
# Session time
sess = tf.Session() # without context manager, close the session later.
writer = tf.summary.FileWriter("/tmp/model/log_tb", sess.graph) # …
Run Code Online (Sandbox Code Playgroud)

python neural-network tensorflow

6
推荐指数
1
解决办法
2784
查看次数

带有 DatetimeIndex [Python] 的 Pandas set_Value

我正在尝试使用 df.set_Value.

df 格式:

    Count   DTW
DateTime        
2015-01-16  10  0
2015-01-17  28  0
Run Code Online (Sandbox Code Playgroud)

使用 df.setValue

dw.set_Value(idx, 'col', dtw) # idx and dtw are int values

TypeError: cannot insert DatetimeIndex with incompatible label
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误,或者有什么具有可比效率的替代方法?

python dataframe pandas

5
推荐指数
1
解决办法
4328
查看次数

标签 统计

python ×2

dataframe ×1

neural-network ×1

pandas ×1

tensorflow ×1