在我的Ubuntu上安装TensorFlow时,我想将GPU与CUDA一起使用.
但我在官方教程的这一步停了下来:
这究竟在哪里./configure?或者我的源树根在哪里.
我的TensorFlow位于此处/usr/local/lib/python2.7/dist-packages/tensorflow.但我还是没找到./configure.
编辑
./configure根据Salvador Dali的回答,我找到了.但是在执行示例代码时,我收到以下错误:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
I tensorflow/core/common_runtime/local_device.cc:25] Local device intra op parallelism threads: 8
E tensorflow/stream_executor/cuda/cuda_driver.cc:466] failed call to cuInit: CUDA_ERROR_NO_DEVICE
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:86] kernel driver does not appear to be running on this host (cliu-ubuntu): /proc/driver/nvidia/version does not exist
I tensorflow/core/common_runtime/gpu/gpu_init.cc:112] DMA:
I tensorflow/core/common_runtime/local_session.cc:45] Local session inter op parallelism threads: 8
Run Code Online (Sandbox Code Playgroud)
无法找到cuda设备.
回答 …
当我pip3 list在终端中,它出现以下错误:
cliu@cliu-ubuntu:~$ pip3 list
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 142, in run_listing
self.output_package_listing(installed_packages)
File "/usr/lib/python3/dist-packages/pip/commands/list.py", line 151, in output_package_listing
if dist_is_editable(dist):
File "/usr/lib/python3/dist-packages/pip/util.py", line 367, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 299, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
Storing debug log for failure in /home/cliu/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)
谁知道如何解决这个问题?
我运行的例子 kaggle_otto_nn.py中Keras与后端theano.当我设置时cnmem=1,出现以下错误:
cliu@cliu-ubuntu:keras-examples$ THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,lib.cnmem=1 python kaggle_otto_nn.py
Using Theano backend.
ERROR (theano.sandbox.cuda): ERROR: Not using GPU. Initialisation of device gpu failed:
initCnmem: cnmemInit call failed! Reason=CNMEM_STATUS_OUT_OF_MEMORY. numdev=1
/usr/local/lib/python2.7/dist-packages/Theano-0.8.0rc1-py2.7.egg/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module.
"downsample module has been moved to the theano.tensor.signal.pool module.")
Traceback (most recent call last):
File "kaggle_otto_nn.py", line 28, in <module>
from keras.models import Sequential
File "build/bdist.linux-x86_64/egg/keras/models.py", line 15, in <module>
File "build/bdist.linux-x86_64/egg/keras/backend/__init__.py", line 46, in …Run Code Online (Sandbox Code Playgroud) 我想知道Apache Commons Lang3(org.apache.commons.lang3)与Apache Commons Text(org.apache.commons.text)之间有什么区别?
我看到他们之间有许多相似之处.
对于intance,他们都有StringEscapeUtils:
但我也看到了许多不同之处.
那么我应该使用哪一个,Lang3还是Text?
或者这两者的常见用例是什么?
为什么静态方法的实现compare的Long,Integer并Short在Java中的图书馆有什么不同?
用于Long:
public static int compare(long x, long y) {
return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
Run Code Online (Sandbox Code Playgroud)
用于Integer:
public static int compare(int x, int y) {
return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
Run Code Online (Sandbox Code Playgroud)
用于Short:
public static int compare(short x, short y) {
return x - y;
}
Run Code Online (Sandbox Code Playgroud) 在开始我的时候spark-shell,我收到了很多WARN消息.但我无法理解他们.我应该注意哪些重要问题?或者我错过了任何配置?或者这些WARN消息是正常的.
cliu@cliu-ubuntu:Apache-Spark$ spark-shell
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Using Spark's repl log4j profile: org/apache/spark/log4j-defaults-repl.properties
To adjust logging level use sc.setLogLevel("INFO")
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 1.5.2
/_/
Using Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66)
Type in expressions …Run Code Online (Sandbox Code Playgroud) 我在以下代码中对原始字符串有一些困惑:
import re
text2 = 'Today is 11/27/2012. PyCon starts 3/13/2013.'
text2_re = re.sub(r'(\d+)/(\d+)/(\d+)', r'\3-\1-\2', text2)
print (text2_re) #output: Today is 2012-11-27. PyCon starts 2013-3-13.
print (r'(\d+)/(\d+)/(\d+)') #output: (\d+)/(\d+)/(\d+)
Run Code Online (Sandbox Code Playgroud)
正如我理解原始字符串,没有r,\被视为转义字符; 使用r,反斜杠\被视为字体.
但是,我在上面的代码中无法理解的是:在正则表达式第5行中,即使有一个r,里面的" \ d "被视为一个数字[0-9]而不是一个反斜杠\加一个信d.
在第二个打印行8中,所有字符都被视为原始字符串.
有什么不同?
我做了以下四种变化,有或没有r:
import re
text2 = 'Today is 11/27/2012. PyCon starts 3/13/2013.'
text2_re = re.sub(r'(\d+)/(\d+)/(\d+)', r'\3-\1-\2', text2)
text2_re1 = re.sub('(\d+)/(\d+)/(\d+)', r'\3-\1-\2', text2)
text2_re2 = re.sub(r'(\d+)/(\d+)/(\d+)', …Run Code Online (Sandbox Code Playgroud) 我正在尝试导入模块,keras.utils.data_utils但它无法正常工作.但是,我可以在这里找到这个模块.它确实存在.为什么我不能导入它,而我可以导入其他模块,如keras.models和keras.layers.core?
cliu@cliu-ubuntu:bin$ python
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import print_function
>>> from keras.models import Sequential
>>> from keras.layers.core import Dense, Activation, Dropout
>>> from keras.layers.recurrent import LSTM
>>> from keras.utils.data_utils import get_file
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named data_utils
Run Code Online (Sandbox Code Playgroud)
编辑:
请看这里的答案.
我正在遵循Flink的快速入门示例:监视Wikipedia编辑流。
该示例使用Java,并且正在Scala中实现,如下所示:
/**
* Wikipedia Edit Monitoring
*/
object WikipediaEditMonitoring {
def main(args: Array[String]) {
// set up the execution environment
val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
val edits: DataStream[WikipediaEditEvent] = env.addSource(new WikipediaEditsSource)
val result = edits.keyBy( _.getUser )
.timeWindow(Time.seconds(5))
.fold(("", 0L)) {
(acc: (String, Long), event: WikipediaEditEvent) => {
(event.getUser, acc._2 + event.getByteDiff)
}
}
result.print
// execute program
env.execute("Wikipedia Edit Monitoring")
}
}
Run Code Online (Sandbox Code Playgroud)
但是,foldFlink中的功能已被弃用,aggregate建议使用该功能。
但我没有找到有关如何转换的过时的例子或教程fold来aggregrate。 …
在ScalaTest中,我有以下检查:
"abc".r shouldBe "abc".r
Run Code Online (Sandbox Code Playgroud)
但它并不平等.我不明白.
abc was not equal to abc
ScalaTestFailureLocation: com.ing.cybrct.flink.clickstream.ConfigsTest$$anonfun$6 at (ConfigsTest.scala:97)
Expected :abc
Actual :abc
Run Code Online (Sandbox Code Playgroud) python ×5
python-2.7 ×3
scala ×3
gpu ×2
java ×2
python-3.x ×2
aggregate ×1
apache-flink ×1
apache-spark ×1
backslash ×1
compare ×1
equality ×1
escaping ×1
fold ×1
import ×1
integer ×1
keras ×1
long-integer ×1
memory ×1
nvidia ×1
pip ×1
rawstring ×1
regex ×1
scalatest ×1
short ×1
tensorflow ×1
theano ×1