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