- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 keras 完全陌生,要开始使用,我正在尝试遵循 this教程。我使用 theano 后端。可悲的是,我已经在这一行遇到了困难:
model.add(Dense(num_pixels, input_dim=num_pixels, init='normal', activation='relu'))
它说:
UserWarning: Update your
Dense
call to the Keras 2 API:Dense(784, input_dim=784, activation="relu", kernel_initializer="normal")
'` call to the Keras 2 API: ' + signature)INFO (theano.gof.compilelock): Refreshing lock [...]
还会引发错误:ImportError:DLL 加载失败:动态链接库 (DLL)初始化例程失败。
我做错了什么?每个想法都受到高度赞赏:D
这是完整的错误回溯(部分德语):
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-59-12b29e43ecfe> in <module>()
----> 1 model = baseline_model()
2
3 model.fit(x_train, y_train, validation_data=(x_test, y_test), nb_epoch=10, batch_size=200, verbose=2)
4
5 scores = model.evaluate(x_test, y_test, verbose=0)
<ipython-input-57-16bc1d352f3b> in baseline_model()
2 model = Sequential() #RNN?
3 #InputLayer
----> 4 model.add(Dense(num_pixels, input_dim=num_pixels, init='normal', activation='relu'))
5 #OutputLayer
6 model.add(Dense(num_classes, init='normal', activation='softmax'))
C:\ProgramData\Anaconda3\lib\site-packages\keras\models.py in add(self, layer)
420 # and create the node connecting the current layer
421 # to the input layer we just created.
--> 422 layer(x)
423
424 if len(layer.inbound_nodes) != 1:
C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py in __call__(self, inputs, **kwargs)
526 '`layer.build(batch_input_shape)`')
527 if len(input_shapes) == 1:
--> 528 self.build(input_shapes[0])
529 else:
530 self.build(input_shapes)
C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py in build(self, input_shape)
825 name='kernel',
826 regularizer=self.kernel_regularizer,
--> 827 constraint=self.kernel_constraint)
828 if self.use_bias:
829 self.bias = self.add_weight((self.units,),
C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py in add_weight(self, shape, initializer, name, trainable, regularizer, constraint)
362 """
363 initializer = initializers.get(initializer)
--> 364 weight = K.variable(initializer(shape), dtype=K.floatx(), name=name)
365 if regularizer is not None:
366 self.add_loss(regularizer(weight))
C:\ProgramData\Anaconda3\lib\site-packages\keras\initializers.py in __call__(self, shape, dtype)
71 def __call__(self, shape, dtype=None):
72 return K.random_normal(shape, self.mean, self.stddev,
---> 73 dtype=dtype, seed=self.seed)
74
75 def get_config(self):
C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\theano_backend.py in random_normal(shape, mean, stddev, dtype, seed)
1935 seed = np.random.randint(1, 10e6)
1936 rng = RandomStreams(seed=seed)
-> 1937 return rng.normal(size=shape, avg=mean, std=stddev, dtype=dtype)
1938
1939
C:\ProgramData\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py in normal(self, size, avg, std, ndim, dtype, nstreams)
1572 n_samples = prod(size) + (prod(size) % 2)
1573 flattened = self.uniform(size=(n_samples,), dtype=dtype,
-> 1574 nstreams=nstreams)
1575
1576 if constant:
C:\ProgramData\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py in uniform(self, size, low, high, ndim, dtype, nstreams)
1352 if nstreams is None:
1353 nstreams = self.n_streams(size)
-> 1354 rstates = self.get_substream_rstates(nstreams, dtype)
1355
1356 if self.use_cuda and dtype == 'float32':
C:\ProgramData\Anaconda3\lib\site-packages\theano\configparser.py in res(*args, **kwargs)
115 def res(*args, **kwargs):
116 with self:
--> 117 return f(*args, **kwargs)
118 return res
119
C:\ProgramData\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py in get_substream_rstates(self, n_streams, dtype, inc_rstate)
1254 # If multMatVect.dot_modulo isn't compiled, compile it.
1255 if multMatVect.dot_modulo is None:
-> 1256 multMatVect(rval[0], A1p72, M1, A2p72, M2)
1257
1258 # This way of calling the Theano fct is done to bypass Theano overhead.
C:\ProgramData\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py in multMatVect(v, A, m1, B, m2)
64 o = DotModulo()(A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym)
65 multMatVect.dot_modulo = function(
---> 66 [A_sym, s_sym, m_sym, A2_sym, s2_sym, m2_sym], o, profile=False)
67
68 # This way of calling the Theano fct is done to bypass Theano overhead.
C:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
324 on_unused_input=on_unused_input,
325 profile=profile,
--> 326 output_keys=output_keys)
327 # We need to add the flag check_aliased inputs if we have any mutable or
328 # borrowed used defined inputs
C:\ProgramData\Anaconda3\lib\site-packages\theano\compile\pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
484 accept_inplace=accept_inplace, name=name,
485 profile=profile, on_unused_input=on_unused_input,
--> 486 output_keys=output_keys)
487
488
C:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
1794 on_unused_input=on_unused_input,
1795 output_keys=output_keys).create(
-> 1796 defaults)
1797
1798 t2 = time.time()
C:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in create(self, input_storage, trustme, storage_map)
1660 theano.config.traceback.limit = theano.config.traceback.compile_limit
1661 _fn, _i, _o = self.linker.make_thunk(
-> 1662 input_storage=input_storage_lists, storage_map=storage_map)
1663 finally:
1664 theano.config.traceback.limit = limit_orig
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\link.py in make_thunk(self, input_storage, output_storage, storage_map)
697 return self.make_all(input_storage=input_storage,
698 output_storage=output_storage,
--> 699 storage_map=storage_map)[:3]
700
701 def make_all(self, input_storage, output_storage):
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\vm.py in make_all(self, profiler, input_storage, output_storage, storage_map)
1045 compute_map,
1046 no_recycling,
-> 1047 impl=impl))
1048 linker_make_thunk_time[node] = time.time() - thunk_start
1049 if not hasattr(thunks[-1], 'lazy'):
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
933 try:
934 return self.make_c_thunk(node, storage_map, compute_map,
--> 935 no_recycling)
936 except (NotImplementedError, utils.MethodNotDefined):
937 # We requested the c code, so don't catch the error.
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
837 _logger.debug('Trying CLinker.make_thunk')
838 outputs = cl.make_thunk(input_storage=node_input_storage,
--> 839 output_storage=node_output_storage)
840 fill_storage, node_input_filters, node_output_filters = outputs
841
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in make_thunk(self, input_storage, output_storage, storage_map, keep_lock)
1188 cthunk, in_storage, out_storage, error_storage = self.__compile__(
1189 input_storage, output_storage, storage_map,
-> 1190 keep_lock=keep_lock)
1191
1192 res = _CThunk(cthunk, init_tasks, tasks, error_storage)
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in __compile__(self, input_storage, output_storage, storage_map, keep_lock)
1129 output_storage,
1130 storage_map,
-> 1131 keep_lock=keep_lock)
1132 return (thunk,
1133 [link.Container(input, storage) for input, storage in
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)
1584 node.op.prepare_node(node, storage_map, None, 'c')
1585 module = get_module_cache().module_from_key(
-> 1586 key=key, lnk=self, keep_lock=keep_lock)
1587
1588 vars = self.inputs + self.outputs + self.orphans
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cmodule.py in module_from_key(self, key, lnk, keep_lock)
1157 try:
1158 location = dlimport_workdir(self.dirname)
-> 1159 module = lnk.compile_cmodule(location)
1160 name = module.__file__
1161 assert name.startswith(location)
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in compile_cmodule(self, location)
1487 lib_dirs=self.lib_dirs(),
1488 libs=libs,
-> 1489 preargs=preargs)
1490 except Exception as e:
1491 e.args += (str(self.fgraph),)
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2345 open(os.path.join(location, "__init__.py"), 'w').close()
2346 assert os.path.isfile(lib_filename)
-> 2347 return dlimport(lib_filename)
2348
2349
C:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cmodule.py in dlimport(fullpath, suffix)
300 warnings.filterwarnings("ignore",
301 message="numpy.ndarray size changed")
--> 302 rval = __import__(module_name, {}, {}, [module_name])
303 t1 = time.time()
304 import_time += t1 - t0
ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
最佳答案
我通过简单地重新安装就解决了这个问题。也许,旧的有什么问题。对于 Windows 用户,我强烈推荐本教程:http://efavdb.com/gpu-accelerated-theano-keras-with-windows-10/
关于python - 为什么这一行会产生错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42885646/
我在 Chrome 上做了一些测试,requestAnimationFrame 产生了 61 fps 而 setTimeOut( callback, 0 ) 产生了 233 fps。 如果一个人想要超
当我调试代码时,我发现 GCC 和 Clang 都为 0.0/0.0 产生 nan,这是我所期望的,但 GCC 产生的 nan 将符号位设置为 1,而Clang 将其设置为 0(如果我没记错的话,与
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我在 R Studio 中有一个时间序列。现在我想计算这个系列的log()。我尝试了以下方法: i <- (x-y) ii <- log(i) 但是我得到以下信息:Warning message: I
我有兴趣了解 JavaScript 的内部结构.我试图阅读 SpiderMonkey 的来源和 Rhino但是绕过我的头是相当复杂的。 我问的原因是:为什么像 (![]+[])[+!![]+[]] 生
我们在 Delphi 中使用标准 TWebbrowser 组件,该组件在内部使用 mshtml.dll。另外,我们使用注册表来确保页面使用新的渲染引擎( Web-Browser-Control-Spe
我必须实现一个序列化/反序列化类,并且我正在使用 System.Xml.Serialization 。我有一些IList类型属性并希望在 IList 中序列化解码属于具有特定区域性信息的列表的所有十进
我有一个 Java 应用程序,它读取包含 SQL 查询的 JSON 文件,并使用 JDBC 在数据库上触发它们。 现在我有 5 万个这样的文件,我需要生成 5 万个独立线程来读取每个文件并将它们上传到
我正在尝试将 TensorFlow 入门页面上的示例线性回归程序调整为二次回归。为此,我只是添加了另一个变量并更改了函数。然而,这似乎会导致 NaN 值。这是我的代码: import numpy as
申请后KernelPCA到我的数据并将其传递给分类器 ( SVC ) 我收到以下错误: ValueError: Input contains NaN, infinity or a value too
这背后的想法是,如果我的数据库中存在登录名(正确的用户名+密码),我将重定向到一个页面,并且在进行此身份验证后,他们可以将消息存储在文本文件中。代码非常简单尽管我不确定为什么会收到 IllegalSt
我有一个返回 log10 值的函数。在将它们转换为正常数字时,出现溢出错误。 OverflowError: (34, 'Numerical result out of range') 我检查了日志值,
nosetests 抛出一个 ImportError,尽管我认为这是一个正确配置的 virtualenv。 ==============================================
我是这个网站的新手,所以如果我做错了什么,我提前道歉。当我尝试使用 kivy-garden 的 ScrollLabel 时,它给了我一个错误。基本上我正在尝试创建一个控制台日志,并且我需要能够在文本框
任何人都对 MDSJ 有任何经验?以下输入仅产生 NaN 结果,我不明白为什么。文档非常稀少。 import mdsj.Data; import mdsj.MDSJ; public class MDS
我有一个非常简单的 scala jcuda 程序,它添加了一个非常大的数组。一切都编译和运行得很好,直到我想从我的设备复制超过 4 个字节到主机。当我尝试复制超过 4 个字节时,我收到 CUDA_ER
我正在使用 Hero 组件在两个页面之间创建动画。Hero 组件用于包装一个 Image 小部件(没问题)和一个 Container 小部件(有问题)。 抛出以下溢出错误: ══╡ EXCEPTIO
我无法理解页面 https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/void 中的这一段: This ope
当在 Angular 中使用不立即触发事件的异步管道时(http 请求或任何有延迟的可观察对象),第一个值为 null为什么会这样?如何避免这种情况? 第一个变化: SimpleChange {
如果一个导入的库生成了一个会 panic 的 goroutine 怎么办?在这种情况下,开发人员无法阻止程序退出。 就像在这段代码中一样,使用延迟恢复调用一个错误的库没有帮助,因为该库正在生成一个 p
我是一名优秀的程序员,十分优秀!