728x90
반응형
728x170
import numpy as np
import tensorflow as tf
ndarray1 = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], dtype = 'int32')
ndarray2 = np.array([(1, 0, 0), (0, 1, 0), (0, 0, 1)], dtype = 'int32')
tensor1 = tf.constant(ndarray1)
tensor2 = tf.constant(ndarray2)
tensor3 = tf.matmul(tensor1, tensor2)
with tf.Session() as sess:
print(sess.run(tensor1))
print(sess.run(tensor2))
print(sess.run(tensor3))
[결과]
[[1 2 3]
[4 5 6]
[7 8 9]]
[[1 0 0]
[0 1 0]
[0 0 1]]
[[1 2 3]
[4 5 6]
[7 8 9]]
728x90
반응형
그리드형(광고전용)
'Python > tensorflow' 카테고리의 다른 글
[PYTHON/TENSORFLOW] 망델브로 집합 출력하기 (0) | 2018.07.04 |
---|---|
[PYTHON/TENSORFLOW] transpose 함수 : 이미지 회전하기 (0) | 2018.07.04 |
[PYTHON/TENSORFLOW] slice 함수 : 이미지 자르기 (0) | 2018.07.04 |
[PYTHON/TENSORFLOW] matrix_determinant 함수 : 행렬식 값 구하기 (0) | 2018.07.03 |
[PYTHON/TENSORFLOW] add 함수 : 행렬 더하기 (0) | 2018.07.03 |
[PYTHON/TENSORFLOW] convert_to_tensor 함수 : 2차원 텐서 구하기 (0) | 2018.07.03 |
[PYTHON/TENSORFLOW] convert_to_tensor 함수 : 1차원 텐서 구하기 (0) | 2018.01.01 |
[PYTHON/TENSORFLOW] 텐서보드 사용하기 (0) | 2018.01.01 |
[PYTHON/TENSORFLOW] placeholder 함수 : 변수 사용하기 (0) | 2018.01.01 |
[PYTHON/TENSORFLOW] Variable 클래스 : 변수 사용하기 (0) | 2018.01.01 |
댓글을 달아 주세요