반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- C언어
- bccard
- web 사진
- classification
- CES 2O21 참가
- cudnn
- discrete_scatter
- web
- tensorflow
- pycharm
- inorder
- KNeighborsClassifier
- vscode
- mglearn
- web 용어
- html
- Keras
- 결합전문기관
- web 개발
- postorder
- 대이터
- CES 2O21 참여
- 데이터전문기관
- 재귀함수
- paragraph
- java역사
- 머신러닝
- 웹 용어
- 자료구조
- broscoding
Archives
- Today
- Total
bro's coding
numpy.브로드캐스팅 본문
반응형
a = np.ones([4,3])
a
'''
array([[1., 1., 1.],
[1., 1., 1.],
[1., 1., 1.],
[1., 1., 1.]])
'''
a+[1,2,3]
'''
[2,3,4]
[2,3,4]
[2,3,4]
[2,3,4]
'''
https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
Broadcasting — NumPy v1.17 Manual
Broadcasting Note See this article for illustrations of broadcasting concepts. The term broadcasting describes how numpy treats arrays with different shapes during arithmetic operations. Subject to certain constraints, the smaller array is “broadcast” acro
docs.scipy.org
브로드캐스팅 : 아래로, 옆으로 계산을 합리적으로 확장
import numpy as np
a=np.arange(9).reshape(3,-1)
a
'''
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
'''
b=np.arange(1000,4000,1000).reshape(3,1)
b
'''
array([[1000],
[2000],
[3000]])
'''
a+b
'''
array([[1000, 1001, 1002],
[2003, 2004, 2005],
[3006, 3007, 3008]])
'''
c=(np.arange(1,4)*0.1).reshape(3,1)
c
'''
array([[0.1],
[0.2],
[0.3]])
'''
a*c
array([[0. , 0.1, 0.2],
[0.6, 0.8, 1. ],
[1.8, 2.1, 2.4]])
반응형
'[IT] > python.numpy' 카테고리의 다른 글
np.moveaxis (0) | 2020.05.13 |
---|---|
numpy.score (0) | 2020.05.12 |
numpy.corrcoef (0) | 2020.04.27 |
numpy.where.3단 논법 (0) | 2020.04.23 |
numpy.무한대 처리 (0) | 2020.03.30 |
numpy.스칼라 연산 (0) | 2020.03.30 |
numpy.file open (0) | 2020.03.27 |
numpy.reshape(차원 변경) (0) | 2020.03.26 |
Comments