小编Cri*_*sti的帖子

计算整个训练集的准确度

我正在运行具有张量流的卷积神经网络的第一次测试.我使用编程指南中的队列运行程序调整了推荐的方法(参见下面的会话定义).输出是cnn的最后一个结果(这里只给出了最后一步).label_batch_vector是训练标签批次.

output = tf.matmul(h_pool2_flat, W_fc1) + b_fc1
label_batch_vector = tf.one_hot(label_batch, 33)

correct_prediction = tf.equal(tf.argmax(output, 1), tf.argmax(label_batch_vector, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

init_op = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer())

print_accuracy = tf.Print(accuracy, [accuracy])

# Create a session for running operations in the Graph.
sess = tf.Session()

# Initialize the variables (like the epoch counter).
sess.run(init_op)

# Start input enqueue threads.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

try:
    while not coord.should_stop():
        # Run training steps or whatever
        sess.run(train_step)
        sess.run(print_accuracy)

except tf.errors.OutOfRangeError:
    print('Done training -- …
Run Code Online (Sandbox Code Playgroud)

tensorflow

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

static const std :: vector

我正在用Qt写一个图像查看器.我试图在头文件中执行以下操作:

class ImageModel
{


private:
    const static std::vector<int> mZoomLevels;

}
Run Code Online (Sandbox Code Playgroud)

在源文件中:

int zooms[] = {1,2,3,4,5,6,7,8,9,10};
const std::vector<int> mZoomLevels(zooms.begin(),zooms.end());
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

在缩放中请求成员'begin'是非类类型'int [10]'对于非类类型'int [10]'的缩放中成员'end'的请求

有谁知道如何初始化这个静态const私有成员?

c++ static const private-members

3
推荐指数
2
解决办法
5799
查看次数

标签 统计

c++ ×1

const ×1

private-members ×1

static ×1

tensorflow ×1