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

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

zNDArray = xNDArray + 1j * yNDArray

zTensor = tf.constant(zNDArray.astype("complex64"))

zsVariable = tf.Variable(zTensor)
nsVariable = tf.Variable(tf.zeros_like(zTensor, "float32"))

tf.InteractiveSession()

tf.global_variables_initializer().run()

cComplex = complex(0.0, 0.75)

zsTensor = zsVariable * zsVariable - cComplex

notDivergedTensor = tf.abs(zsTensor) < 4

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

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

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

 

728x90

 

[결과]

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

댓글을 달아 주세요