zoukankan      html  css  js  c++  java
  • NumPy笔记:多维度数组

    """
        多维数组
    """
    import numpy as np
     
    print("--------------多维数组----------------")
    data = np.array(3)
    data1 = np.array([1, 2, 3, 4, 5, 6])
    data2 = np.array([[1, 2, 3, 4, 5, 6]])
    data3 = np.array([[[1, 2, 3, 4, 5, 6]]], dtype=float)
     
    print("标量:", data, data.shape, type(data), data.dtype)
    print("数组:", data1, data1.shape, type(data1), data1.dtype)
    print("矩阵:", data2, data2.shape, type(data2), data2.dtype)
    print("张量:", data3, data3.shape, type(data3), data3.dtype)
    --------------多维数组----------------
    标量: 3 () <class 'numpy.ndarray'> int32
    数组: [1 2 3 4 5 6] (6,) <class 'numpy.ndarray'> int32
    矩阵: [[1 2 3 4 5 6]] (1, 6) <class 'numpy.ndarray'> int32
    张量: [[[1. 2. 3. 4. 5. 6.]]] (1, 1, 6) <class 'numpy.ndarray'> float64
    
     
  • 相关阅读:
    JS可改变列宽table
    无图片,用css border实现尖三角
    IE6下position:fixed;兼容
    巧用cssText属性批量操作样式
    Java
    Java
    Java
    JRebel
    Spring
    ActiveMQ
  • 原文地址:https://www.cnblogs.com/jumpkin1122/p/11503590.html
Copyright © 2011-2022 走看看