简体   繁体   English

当我使用 tensorflow 时出现错误 Segmentation fault (core dumped)

[英]arise error Segmentation fault (core dumped) when I use tensorflow

arise error Segmentation fault (core dumped) when I use tensorflow, my code is :当我使用 tensorflow 时出现错误 Segmentation fault (core dumped),我的代码是:

from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.layers import Embedding
from keras.layers import LSTM
from keras.utils import to_categorical

model = Sequential()
max_features = 100
model.add(Embedding(max_features, output_dim=256))
model.add(LSTM(128))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

print("model is ok ")

Segmentation fault means that you tried to access memory that you do not have access. Segmentation fault意味着您尝试访问您无权访问的内存。 If you choose right combination of Tensorflow , CUDA and cuDNN will solve this issue.如果选择正确的Tensorflow组合, CUDAcuDNN将解决这个问题。 You can refer tested build configuration .您可以参考经过测试的构建配置

I was able to execute above code without any issues.我能够毫无问题地执行上面的代码。 Please refer the same as shown below请参考下图

import tensorflow as tf
print(tf.__version__)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Embedding, LSTM

model = Sequential()
max_features = 100
model.add(Embedding(max_features, output_dim=256))
model.add(LSTM(128))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
model.summary()

model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

print("model is ok ")

Output:输出:

2.5.0
Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding (Embedding)        (None, None, 256)         25600     
_________________________________________________________________
lstm (LSTM)                  (None, 128)               197120    
_________________________________________________________________
dropout (Dropout)            (None, 128)               0         
_________________________________________________________________
dense (Dense)                (None, 1)                 129       
=================================================================
Total params: 222,849
Trainable params: 222,849
Non-trainable params: 0
_________________________________________________________________
model is ok 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tensorflow-获取分段错误(核心转储)错误 - Tensorflow - getting Segmentation fault (core dumped) error cifar10的分段错误(核心转储)错误 - Segmentation fault (core dumped) error for cifar10 example tensorflow [tensorflow]安装tensorflow-gpu,导入错误为分段错误(核心转储) - [tensorflow]install tensorflow-gpu with import error as Segmentation fault (core dumped) Jetson TX2 上的 Tensorflow 导入导致分段错误(核心转储) - Tensorflow import on Jetson TX2 results in Segmentation fault (core dumped) 分段错误(核心转储) - TFLite - Segmentation fault (core dumped) - TFLite 如何解决Keras中的“分段错误(核心转储”错误) - How to fix 'Segmentation fault (core dumped" error in Keras tf.Session() 上的分段错误(核心转储) - Segmentation fault (core dumped) on tf.Session() 安装keras和tensorflow之后,python脚本因Segmentation Fault(崩溃的核心)崩溃 - After installing keras and tensorflow, python script crashes with Segmentation Fault (core dumped) 分段错误(核心转储) - 使用来自 SavedModel 的 Tensorflow C++ API 进行推断 - Segmentation fault (core dumped) - Infering with Tensorflow C++ API from SavedModel 在tensorflow中使用队列运行器时出现错误 - error arise when using queue runner in tensorflow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM