test.py 687 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. # -*- coding:utf-8 -*-
  3. # @FileName :test.py
  4. # @Time :2025/3/5 18:11
  5. # @Author :David
  6. # @Company: shenyang JY
  7. import numpy as np
  8. # import tensorflow as tf
  9. # print("TensorFlow 版本:", tf.__version__)
  10. # print("GPU 是否可用:", tf.config.list_physical_devices('GPU'))
  11. # 生成三个形状为 (2, 3, 4) 的三维数组
  12. # arrays = [np.random.rand(2, 3, 4) for _ in range(3)]
  13. #
  14. # # 沿新维度 axis=0 堆叠
  15. # stacked = np.stack(arrays, axis=2)
  16. #
  17. # print("堆叠后的形状:", stacked.shape)
  18. arrays = [np.random.rand(3, 3) for _ in range(2)]
  19. # 沿新维度 axis=0 堆叠
  20. stacked = np.stack(arrays, axis=0)
  21. print("堆叠后的形状:", stacked.shape)