【问题标题】:"This TensorFlow binary is optimized with Intel(R) MKL-DNN... enable them in non-MKL-DNN operations" What can I do?“这个 TensorFlow 二进制文件使用 Intel(R) MKL-DNN 进行了优化......在非 MKL-DNN 操作中启用它们”我能做什么?
【发布时间】:2019-12-25 18:07:01
【问题描述】:

我已经使用 conda 安装了 tensorflow。当我测试它时,我得到了这个性能:

import tensorflow as tf
print(tf.__version__)

a = tf.constant([1, 2])
b = tf.constant([3, 4])
print(a + b)

输出

C:\Users\NHoracio\Miniconda3\envs\tesis\python.exe "D:/Dropbox/Codigos/Python3/TensorFlow test/test.py"
2.0.0
2019-12-25 12:13:37.613118: 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:
AVX AVX2

To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-12-25 12:13:37.621213: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with
default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.

tf.Tensor([4 6], shape=(2,), dtype=int32)

我知道它可以继续以这种方式工作,但我不确定我是否理解该信息。 我想知道我是否可以提高 CPU 的性能,或者我必须为该消息做什么?

配置: 视窗 10 64b。 英特尔 i5 8250。 广发MX130 Python 3.7.4 PyCharm 2019.3.1 康达 4.8.0 TensorFlow 2.0.0

【问题讨论】:

    标签: python windows tensorflow


    【解决方案1】:

    我今天早上更新了 tensorflow,并且那个特定的错误消息不再存在。这是我正在运行的代码:

    # smorgasbord of import statements scraped from random Internet sites
    from tensorflow.keras import Sequential
    from tensorflow.keras.layers import Dense
    from tensorflow.keras.constraints import unit_norm
    from tensorflow.keras.utils import to_categorical
    import numpy as np
    from sklearn.preprocessing import LabelEncoder
    from sklearn.model_selection import StratifiedKFold
    import pandas as pd
    
    # import os
    # print(os.getcwd())
    
    # establishing a single random seed for reproducibility of results
    seed = 7
    np.random.seed(seed)
    
    # load Bezdek Iris dataset
    dataframe = pd.read_csv("BezdekIris.csv", header=None)
    
    # split into input (X) and output (Y) variables
    dataset = dataframe.values
    X = dataset[:, 0:3].astype(float)
    Y = dataset[:, 4]
    
    # create dummy indicator output variables to use in Keras
    encoder = LabelEncoder()
    encoder.fit(Y)
    encoded_Y = encoder.transform(Y)
    
    # convert integers to dummy variables (i.e. one hot encoded)
    dummy_y = to_categorical(encoded_Y)
    
    # cross-validation train/test methodology scraped from the Internet
    kfold = StratifiedKFold(n_splits=10, shuffle=True, random_state=seed)
    cvscores = []
    for train, test in kfold.split(X, Y):
        # create model (no idea what I am doing here at all...)
        model = Sequential()
        model.add(Dense(12, input_dim=3, activation='relu',
                        kernel_constraint=unit_norm()))
        model.add(Dense(3, activation='relu', kernel_constraint=unit_norm()))
        model.add(Dense(3, activation='softmax', kernel_constraint=unit_norm()))
    
        # compile and evaluate model (no idea why these options work/if they do)
        model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
        model.fit(X[train], dummy_y[train], epochs=150, batch_size=10, verbose=0)
        scores = model.evaluate(X[test], dummy_y[test], verbose=0)
    
        # display each validation fold's results
        print("%s:  %.2f%%" % (model.metrics_names[1], scores[1] * 100))
        cvscores.append(scores[1] * 100)
    
    # display overall results
    print("%.2f%% (+/-%.2f%%)" % (np.mean(cvscores), np.std(cvscores)))
    

    【讨论】:

    • 当然,还有一条我以前没见过的红色文字的新消息……但至少看起来不严重,现在只有两条这样的消息显示。从现在开始,不理会我的代码并更新 tensorflow 是我的默认路径。
    猜你喜欢
    • 1970-01-01
    • 2022-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-30
    • 2013-11-13
    • 2019-05-27
    • 1970-01-01
    相关资源
    最近更新 更多