본문 바로가기
-------------코딩-------------/Tensorflow & pandas

tensorflow 2.0 기본 사칙연산

by 탶선 2020. 1. 11.
반응형

tensorflow 2.0 기본

 

문자열 출력

import tensorflow as tf
a = tf.constant('hello world')
a
a.numpy()
type(a)
type(a.numpy())

 

 

constant를 사용한 사칙연산

A = tf.constant(2)
B = tf.constatn(3)

C = A + B
C = tf.add(A,B)
C

C.numpy()

D = 5

E = C * D
E = tf.multiply(C,D)
E

E.numpy()

 

 

행렬곱 계산

Matrix_A = [[1,2],[3,4]]

Matrix_B = [[3,4],[4,5]]

Matrix_C = tf.matmul(Matrix_A, Matrix_B)
Matrix_C
반응형

댓글