[API] Tensorflow Control Flow
(텐서플로우 제어 연산자)
Note: Functions taking Tensor arguments can also take anything accepted by tf.convert_to_tensor .
Tensorflow Logical Operators
TensorFlow provides several operations that you can use to add logical operators to your graph.
tf.logical_and(x, y, name=None)
Returns the truth value of x AND y element-wise.
Args:
x
: ATensor
of typebool
.y
: ATensor
of typebool
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.logical_and 결과
In [1]: import tensorflow as tf
tf.logical_not(x, name=None)
Returns the truth value of NOT x element-wise.
Args:
x
: ATensor
of typebool
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.logical_not 결과
In [1]: import tensorflow as tf
tf.logical_or(x, y, name=None)
Returns the truth value of x OR y element-wise.
Args:
x
: ATensor
of typebool
.y
: ATensor
of typebool
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.logical_or 결과
In [1]: import tensorflow as tf
tf.logical_xor(x, y, name='LogicalXor')
x ^ y = (x | y) & ~(x & y).
Tensorflow tf.logical_xor 결과
In [1]: import tensorflow as tf
Tensorflow Comparison Operators
TensorFlow provides several operations that you can use to add comparison operators to your graph.
tf.equal(x, y, name=None)
Returns the truth value of (x == y) element-wise.
Args:
x
: ATensor
. Must be one of the following types:half
,float32
,float64
,uint8
,int8
,int16
,int32
,int64
,complex64
,quint8
,qint8
,qint32
,string
,bool
,complex128
.y
: ATensor
. Must have the same type asx
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.equal 결과
In [1]: import tensorflow as tf
tf.not_equal(x, y, name=None)
Returns the truth value of (x != y) element-wise.
Args:
x
: ATensor
. Must be one of the following types:half
,float32
,float64
,uint8
,int8
,int16
,int32
,int64
,complex64
,quint8
,qint8
,qint32
,string
,bool
,complex128
.y
: ATensor
. Must have the same type asx
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.not_equal 결과
In [1]: import tensorflow as tf
tf.less(x, y, name=None)
Returns the truth value of (x < y) element-wise.
Args:
• x : A Tensor . Must be one of the following types: float32 , float64 , int32 , int64 , uint8 , int16 , int8 , uint16 , half .
• y : A Tensor . Must have the same type as x .
• name : A name for the operation (optional).
Returns:
A Tensor of type bool .
Tensorflow tf.less 결과
In [1]: import tensorflow as tf
tf.less_equal(x, y, name=None)
Returns the truth value of (x <= y) element-wise.
Args:
x
: ATensor
. Must be one of the following types:float32
,float64
,int32
,int64
,uint8
,int16
,int8
,uint16
,half
.y
: ATensor
. Must have the same type asx
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.less_equal 결과
In [1]: import tensorflow as tf
tf.greater(x, y, name=None)
Returns the truth value of (x > y) element-wise.
Args:
x
: ATensor
. Must be one of the following types:float32
,float64
,int32
,int64
,uint8
,int16
,int8
,uint16
,half
.y
: ATensor
. Must have the same type asx
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.greater 결과
In [1]: import tensorflow as tf
tf.greater_equal(x, y, name=None)
Returns the truth value of (x >= y) element-wise.
Args:
x
: ATensor
. Must be one of the following types:float32
,float64
,int32
,int64
,uint8
,int16
,int8
,uint16
,half
.y
: ATensor
. Must have the same type asx
.name
: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
Tensorflow tf.greater_equal 결과
In [1]: import tensorflow as tf
이 포스팅은 머신러닝/딥러닝 오픈소스 Tensorflow 개발을 위한 선행학습으로 Tensorflow API Document의 Python API 대한 학습노트입니다.
'머신러닝&딥러닝 개발 > Tensorflow API' 카테고리의 다른 글
[API] TensorBoard: Usage (0) | 2018.01.26 |
---|---|
[API] Tensorboard: Visualizaing Learning (텐서보드: 학습 시각화) (0) | 2018.01.24 |
[API] Tensorflow Math (텐서플로우 수학 함수) (0) | 2018.01.17 |
[API] Tensorflow Convert to Tensor - slicing and joining(텐서플로우 텐서 변환 - 자르고 붙이기) (0) | 2018.01.13 |
[API] Tensorflow Convert to Tensor - Shape and Shaping(텐서플로우 텐서 변환 - 구조 및 구조 변형) (0) | 2018.01.13 |