0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

numpy完全攻略

Last updated at Posted at 2021-05-26

numpyで?ってなったことをまとめる。イディオム的に。

1. image.shape==[3.64,64] を [1,3,64,64]に変更する

image=np.stack([image])

2. numpyをTensor型にしてcudaに乗せる

image=torch.from_numpy(image).cuda()

3. csvから数字データを取ってきてnumpy配列に格納する

with open('name.csv','r') as f:
    reader=csv.reader(f)
    l=[row for row in reader]
    l=np.array(l).astype('int64')

csvから取ってきた後にastypeでキャストするのを忘れないようにする

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?