텐서와 연산자 기본 예제
# tensors or operations
import tensorflow as tf
print(tf.add(1, 3))
print(tf.add([1, 2], [3, 4]))
print(tf.square(5))
print(tf.reduce_sum([1, 2, 3]))
# 연산자 오버로딩도 지원됩니다.
print(tf.square(2) + tf.square(3))
실행 결과
tf.Tensor(4, shape=(), dtype=int32)
tf.Tensor([4 6], shape=(), dtype=int32)
tf.Tensor(25, shape=(), dtype=int32)
tf.Tensor(6, shape=(), dtype=int32)
tf.Tensor(13, shape=(), dtype=int32)
'TensorFlow 2.0' 카테고리의 다른 글
Tensorflow Dataset Info 보기 (0) | 2019.11.02 |
---|---|
Tensorflow Dataset 목록 보기 (0) | 2019.11.01 |
텐서(Tensor) 란? (0) | 2019.10.19 |
비용줄이기 (기울기예측) 예제 (0) | 2019.10.17 |
TensorFlow 2.0 기본 예제 (연산자) (0) | 2019.10.14 |