numpy-squeeze用法

    xiaoxiao2023-10-09  145

    numpy-squeeze用法

    import numpy as np a = np.random.randn(1,1) b = np.random.randn(1) print(a) print(a.shape) a1 = np.squeeze(a) print(a1) print(b) print(b.shape) b1 = np.squeeze(b) print(b1) ------------------ [[-0.52917295]] (1, 1) -0.5291729466047799 [0.81425995] (1,) 0.8142599473487426

    看起来挺简单的,为了防止忘记,做个笔记记录一下

    最新回复(0)