zoukankan      html  css  js  c++  java
  • Python:numpy中shape和reshape的用法

    >>> w=np.zeros((5,6))
    >>> w
    array([[ 0.,  0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.],
           [ 0.,  0.,  0.,  0.,  0.,  0.]])

    >>> w.shape[0]
    5

    >>> w.shape[1]
    6

    w是一个5行6列的矩阵

    w.shape[0]返回的是w的行数

    w.shape[1]返回的是w的列数

  • 相关阅读:
    A
    hdu 2108 Shape of HDU(判定是不是凸多边形)
    F
    J
    扩展欧几里得
    G
    A
    D
    E
    H
  • 原文地址:https://www.cnblogs.com/Davirain/p/8520143.html
Copyright © 2011-2022 走看看