def initialize_param(self): self.param = tfg.Variable(tff.get_truncated_normal(shape=self.shape, mean=self.mean, sd=self.sd, low=self.low, upp=self.upp), name=self.name)
def initialize_param(self): sd = math.sqrt(1.0 / self.shape[0]) self.param = tfg.Variable(tff.get_truncated_normal(shape=self.shape, mean=0.0, sd=sd, low=-sd, upp=sd), name=self.name)
def initialize_param(self): if len(self.shape) == 2: sd = math.sqrt(2.0 / (self.shape[0] + self.shape[1])) else: sd = math.sqrt(2.0 / self.shape[0]) self.param = tfg.Variable(np.random.uniform(low=-sd, high=sd, size=self.shape), name=self.name)
def initialize_param(self): if len(self.shape) == 2: sd = math.sqrt(2.0 / (self.shape[0] + self.shape[1])) else: sd = math.sqrt(2.0 / self.shape[0]) self.param = tfg.Variable(tff.get_truncated_normal(shape=self.shape, mean=0.0, sd=sd, low=-sd, upp=sd), name=self.name)
def initialize_param(self): self.param = tfg.Variable(np.random.random(size=self.shape), name=self.name)
def initialize_param(self): self.param = tfg.Variable(np.random.normal(loc=self.mean, scale=self.sd, size=self.shape), name=self.name)
def initialize_param(self): self.param = tfg.Variable(np.ones(shape=self.shape) * 0.1, name=self.name)
def initialize_param(self): self.param = tfg.Variable(np.random.randn(self.shape[0], self.shape[1]), name=self.name)
def initialize_param(self): self.param = tfg.Variable(np.zeros(shape=self.shape), name=self.name)
def initialize_param(self): self.param = tfg.Variable(self.value, name=self.name)
def initialize_param(self): sd = math.sqrt(2.0 / (self.shape[1] * self.shape[2] * self.shape[3])) self.param = tfg.Variable(np.random.uniform(low=-sd, high=sd, size=self.shape), name=self.name)
from Tensorflux import graph as tfg from Tensorflux import session as tfs import networkx_test as nx import matplotlib.pyplot as plt g = tfg.Graph() #그래프 객체 생성 g.initialize() #생성한 그래프 객체 초기화 # Create variables A = tfg.Variable([[1, 0], [0, -1]], name="A") b = tfg.Variable([1, 1], name="b") # Create placeholder x = tfg.Placeholder(name="x") # Create hidden node y y = tfg.Matmul(A, x, name="y") # Create output node z z = tfg.Add(y, b, name="z") nx.draw_networkx(g, with_labels=True) plt.show(block=True) session = tfs.Session() output = session.run(z, {x: [1, 2]}) print(output)