LoginSignup
0
0

More than 1 year has passed since last update.

M1 MacOSにtensorflowをinstall

Posted at

M1 Macにtensorflowをインストール

インストール失敗

普通にpipでインストールしようとすると失敗する。

$ pip install tensorflow  

ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

インストール方法

tensorflow-macosをインストールする。

pip install tensorflow-macos

使用する

使用する際はimport tensorflow-macosではなくimport tensorflowで良い。
import tensorflow-macosではSyntaxErrorとなる。

import tensorflow as tf

input_shape = (4, 28, 28, 1)
x = tf.random.normal(input_shape)
y = tf.keras.layers.Conv2D(6, (3, 3), activation='relu', dilation_rate=2, input_shape=input_shape[1:])(x)

print(y.shape)

簡単な例題を実行したが、動作は特に問題なさそう。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0