Tensor_연산 (기본 명령어)

Seol Jang·2023년 5월 11일

Tensorflow

목록 보기
2/3

[행렬과 관련된 연산]

  • tf.matmul : 내적
  • tf.linalg.inv : 역행렬

[크기 및 차원을 바꾸는 명령]

  • tf.reshape : 벡터행렬의 크기변환
  • tf.transpose : 전치연산
  • tf.expand_dims : 지정한 축으로 차원을 추가
  • tf.squeeze : 벡터로 차원을 축소

[텐서를 나누거나 두개 이상의 텐서를 합치는 명령]

  • tf.slice : 특정 부분 추출
  • tf.split : 분할
  • tf.concat : 합치기
  • tf.tile : 복제 - 붙이기
  • tf.stack : 합성
  • tf.unstack : 분리
    stack은 차원을 하나 더 만들어서 추가하는 것(concat과의 차이)

ex) 코드를 에러없이 실행해보기

a = tf.constant(((1,2,3), (1,2,3)))
b = tf.constant([1,2,3])
tf.matmul(a, b)

sol)

tf.matmul
(a, tf.expand_dims (b, axis=1))

profile
Data Scientist%%

0개의 댓글