You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Spyder环境下TensorFlow SSE4.1/AVX等CPU指令启用问题求助

关于TensorFlow运行时提示信息的说明与解决方案

首先,先看你运行的这段Keras代码:

from keras.datasets import imdb as im
from keras.preprocessing import sequence as seq
from keras.models import Sequential
from keras.layers import Embedding
from keras.layers import LSTM
from keras.layers import Dense
train_set, test_set = im.load_data(num_words = 10000)
X_train, y_train = train_set
X_test, y_test = test_set
X_train_padded = seq.pad_sequences(X_train, maxlen = 100)
X_test_padded = seq.pad_sequences(X_test, maxlen = 100)
model = Sequential()
model.add(Embedding(input_dim=10000, output_dim=128))
model.add(LSTM(units=128))
model.add(Dense(units=1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='sgd', metrics=['accuracy'])
scores = model.fit(X_train_padded,y_train)

运行时弹出的这段提示:

I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance.

别担心,这不是错误,只是TensorFlow给你的性能优化提示而已!

拆解下提示的含义:

  • 第一段提示:你安装的TensorFlow预编译包已经用Intel MKL-DNN做了优化,会在核心计算操作里自动调用你CPU支持的SSE4.1、SSE4.2等指令集来加速运算。后面那句“非MKL-DNN操作需重新编译启用”完全不用在意——普通用户根本不需要自己编译TensorFlow,官方包的MKL-DNN优化已经覆盖了绝大多数常用场景,性能足够用。
  • 第二段提示:TensorFlow默认创建了4个线程的线程池来处理并行计算,如果你想极致优化性能,可以调整inter_op_parallelism_threads参数,但这属于进阶操作,对你当前的IMDB情感分类任务来说,默认设置完全能正常运行。

你接下来的操作:

直接忽略这些提示就好!你的代码已经在正常执行了,稍等一会儿就能看到训练过程的loss和accuracy输出。如果后续真的出现报错再排查问题,目前这些只是正常的日志信息,不是故障。

另外你的配置:osx-64,MacOS Mojave v.10.14.6,Python 3.7(搭配Anaconda的Spyder),conda版本4.7.12,TensorFlow 1.14.0,这些都是完全没问题的,和当前提示没有冲突。

内容的提问来源于stack exchange,提问作者Ahsan Khan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:07:53