【问题标题】:Uninitialized Variables in Google ColabGoogle Colab 中的未初始化变量
【发布时间】:2019-01-08 06:47:06
【问题描述】:

我在 google colab 中运行 CNN 架构,但是,即使在将我的变量初始化为全局变量之后,我仍然会收到错误“变量未定义”。还有其他解决方法吗?请指导我通过适当的方式来帮助克服这个问题。

global bits, L_weights

bits_init = bit_level_precision(cond_vals, normal_dist, num_bits, max_w_b_norm)
if model_used == 'normal':
    L_weights_init = xbar_output(bits_init[0],w_inp, w_dim)

elif model_used == 'proposed':
    f_grp_mapping = []
    L_weights_init = xbar_output_prop(bits_init[0],w_inp, w_dim, grouped_cells, f_grp_mapping)

if fix_used == 'none':
    bits = bit_level_precision(cond_vals, new_xbar, num_bits, max_w_b_norm)
    L_weights = xbar_output(bits[0],w_inp, w_dim)

【问题讨论】:

标签: python-3.x jupyter-notebook google-colaboratory


【解决方案1】:

每当您打开 Google colab notebook 时,尝试使用 Ctrl+F9 运行第一个单元格中的所有单元格,这可能会解决您的问题。您之前可能已经在其他某个基于云的运行时上工作的其他单元中定义了变量,当您重新打开笔记本时,所有单元元素都将被保存,但需要在与现在相同的基于云的运行时上工作。

【讨论】:

    猜你喜欢
    • 2016-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-01
    • 2013-08-25
    • 1970-01-01
    • 2017-12-10
    • 2014-04-05
    相关资源
    最近更新 更多