Apple M2芯片安装tensorflow 安装不上的问题

import tensorflow as tf

cifar = tf.keras.datasets.cifar100
(x_train, y_train), (x_test, y_test) = cifar.load_data()
model = tf.keras.applications.ResNet50(
    include_top=True,
    weights=None,
    input_shape=(32, 32, 3),
    classes=100,)

loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)

   下载清华镜像源Anaconda arm的

  1. 安装miniforge3: https: //github.com/conda-forge/miniforge/#download
    1. Apple Silicon链接

     Apple M2芯片安装tensorflow 安装不上的问题_第1张图片

    看看苹果官方提供的 Tensorflow Plugin - Metal - Apple Developer

    bash ~/miniconda.sh -b -p $HOME/miniconda
    source ~/miniconda/bin/activate
    conda install -c apple tensorflow-dep
    python -m pip install tensorflow-metal
    python -m pip install tensorflow-macos

你可能感兴趣的:(tensorflow,python,人工智能)