첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
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
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요