Oops, accidentally marked as the answer.
Issue is the same:
Calculations on GPU leads to drastically different results compared to CPU.
Windows PC with CUDA GPU gives correct result similar to M1 CPU only computation.
Stock prediction source code from:
https://www.thepythoncode.com/article/stock-price-prediction-in-python-using-tensorflow-2-and-keras
My implementation and results:
https://disk.yandex.ru/d/S0FqJTL582V1Pw
macOs Monterey 12.1, MBA M1
tensorflow-macos 2.7.0
tensorflow-metal 0.3.0
CPU results:
GPU results: