欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

首頁綜合 正文
目錄

柚子快報(bào)激活碼778899分享:numpy統(tǒng)計(jì)元素個(gè)數(shù)

柚子快報(bào)激活碼778899分享:numpy統(tǒng)計(jì)元素個(gè)數(shù)

http://yzkb.51969.com/

目錄

torch導(dǎo)入時(shí)間

numpy求平均,統(tǒng)計(jì)元素個(gè)數(shù)

torch導(dǎo)入時(shí)間

發(fā)現(xiàn)導(dǎo)入torch需要1.5秒左右,

如果是多進(jìn)程,每個(gè)進(jìn)場都需要導(dǎo)入torch,每次時(shí)間都需要1.5秒。

numpy求平均,統(tǒng)計(jì)元素個(gè)數(shù)

100萬數(shù)據(jù),求均值耗時(shí)為0,統(tǒng)計(jì)元素個(gè)數(shù)耗時(shí)15毫秒 ms。

import time

import numpy as np

start=time.time()

# import torch

print('import torch time',time.time()-start)

vector = np.random.randint(1, 11, size=1000000)

start=time.time()

aa=vector.mean()

print('mean time',time.time()-start)

start=time.time()

unique_elements, counts = np.unique(vector, return_counts=True)

# 找出出現(xiàn)次數(shù)最多的元素及其次數(shù)

max_count_index = np.argmax(counts) # 出現(xiàn)次數(shù)最多的元素的索引

most_frequent_element = unique_elements[max_count_index]

max_count = counts[max_count_index]

print(f"重復(fù)次數(shù)最多的數(shù)是: {most_frequent_element}")

print(f"重復(fù)次數(shù)是: {max_count}")

print('time',time.time()-start)

柚子快報(bào)激活碼778899分享:numpy統(tǒng)計(jì)元素個(gè)數(shù)

http://yzkb.51969.com/

推薦鏈接

評論可見,查看隱藏內(nèi)容

本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場。

轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://m.gantiao.com.cn/post/19095756.html

發(fā)布評論

您暫未設(shè)置收款碼

請?jiān)谥黝}配置——文章設(shè)置里上傳

掃描二維碼手機(jī)訪問

文章目錄