brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip3 install numpy==1.19.3
Maybe some deps rely on openssl@1.1 and some depend on openssl@3.0
brew install zlib openssl
export cpp and linker flags
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openblas/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openblas/include"
export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.12.2
pip install --no-binary=h5py h5py==3.1.0
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install grpcio==1.34.0
pip install tensorflow-macos==2.5.0
import tensorflow as tf
tf.__version__
tf.config.list_physical_devices()
import numpy as np
X = np.arange(1, 101, step=0.1)
y = [x**2 for x in X]
X = tf.cast(tf.constant(X), dtype=tf.float32)
y = tf.cast(tf.constant(y), dtype=tf.float32)
model = tf.keras.Sequential([
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(1)
])
model.compile(
loss=tf.keras.losses.mean_absolute_error,
optimizer=tf.keras.optimizers.Adam(learning_rate=0.1),
metrics=['mean_absolute_error']
)
model.fit(X, y, epochs=100)
model.predict([10, 20, 30])