첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
import matplotlib.pyplot as pp
import numpy as np
import tensorflow as tf

yNDArray, xNDArray = np.mgrid[-1.3:1.3:0.005, -2:1:0.005]

zNDArray = xNDArray + 1j * yNDArray

cTensor = tf.constant(zNDArray.astype(np.complex64))

zsVariable = tf.Variable(cTensor)
nsVariable = tf.Variable(tf.zeros_like(cTensor, tf.float32))

session = tf.InteractiveSession()

tf.global_variables_initializer().run()

zsTensor = zsVariable * zsVariable + cTensor

notDivergedTensor = tf.abs(zsTensor) < 4

stepOperation = tf.group(zsVariable.assign(zsTensor), nsVariable.assign_add(tf.cast(notDivergedTensor, tf.float32)))

for i in range(200):
    stepOperation.run()

pp.imshow(nsVariable.eval())
pp.show()

 

728x90

 

[결과]

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요