當前位置: 首頁>>代碼示例>>Python>>正文


Python TensorGraph.add_output方法代碼示例

本文整理匯總了Python中deepchem.models.TensorGraph.add_output方法的典型用法代碼示例。如果您正苦於以下問題:Python TensorGraph.add_output方法的具體用法?Python TensorGraph.add_output怎麽用?Python TensorGraph.add_output使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在deepchem.models.TensorGraph的用法示例。


在下文中一共展示了TensorGraph.add_output方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _build_graph

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
 def _build_graph(self, tf_graph, scope, model_dir):
   """Construct a TensorGraph containing the policy and loss calculations."""
   state_shape = self._env.state_shape
   state_dtype = self._env.state_dtype
   if not self._state_is_list:
     state_shape = [state_shape]
     state_dtype = [state_dtype]
   features = []
   for s, d in zip(state_shape, state_dtype):
     features.append(Feature(shape=[None] + list(s), dtype=tf.as_dtype(d)))
   policy_layers = self._policy.create_layers(features)
   action_prob = policy_layers['action_prob']
   value = policy_layers['value']
   search_prob = Label(shape=(None, self._env.n_actions))
   search_value = Label(shape=(None,))
   loss = MCTSLoss(
       self.value_weight,
       in_layers=[action_prob, value, search_prob, search_value])
   graph = TensorGraph(
       batch_size=self.max_search_depth,
       use_queue=False,
       graph=tf_graph,
       model_dir=model_dir)
   for f in features:
     graph._add_layer(f)
   graph.add_output(action_prob)
   graph.add_output(value)
   graph.set_loss(loss)
   graph.set_optimizer(self._optimizer)
   with graph._get_tf("Graph").as_default():
     with tf.variable_scope(scope):
       graph.build()
   if len(graph.rnn_initial_states) > 0:
     raise ValueError('MCTS does not support policies with recurrent layers')
   return graph, features, action_prob, value, search_prob, search_value
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:37,代碼來源:mcts.py

示例2: test_Conv1D_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Conv1D_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1, 1))
  conv = Conv1D(2, 1, in_layers=feature)
  tg.add_output(conv)
  tg.set_loss(conv)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例3: test_Reshape_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Reshape_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = Reshape(shape=(None, 2), in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例4: test_Exp_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Exp_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = Exp(feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例5: test_Dense_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Dense_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  dense = Dense(out_channels=1, in_layers=feature)
  tg.add_output(dense)
  tg.set_loss(dense)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例6: test_StopGradient_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_StopGradient_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  output = StopGradient(feature)
  tg.add_output(output)
  tg.set_loss(output)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例7: test_DTNNEmbedding_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_DTNNEmbedding_pickle():
  tg = TensorGraph()
  atom_numbers = Feature(shape=(None, 23), dtype=tf.int32)
  Embedding = DTNNEmbedding(in_layers=[atom_numbers])
  tg.add_output(Embedding)
  tg.set_loss(Embedding)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例8: test_Gather_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Gather_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = Gather(indices=[[0], [2], [3]], in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例9: test_BatchNorm_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_BatchNorm_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 10))
  layer = BatchNorm(in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例10: test_WeightedError_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_WeightedError_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 10))
  layer = WeightedError(in_layers=[feature, feature])
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例11: test_Conv3DTranspose_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_Conv3DTranspose_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 10, 10, 10, 1))
  layer = Conv3DTranspose(num_outputs=3, in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例12: test_ReduceSquareDifference_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_ReduceSquareDifference_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = ReduceSquareDifference(in_layers=[feature, feature])
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例13: test_ToFloat_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_ToFloat_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = ToFloat(in_layers=[feature])
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例14: test_LSTM_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_LSTM_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 10, 10))
  layer = LSTM(n_hidden=10, batch_size=tg.batch_size, in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py

示例15: test_CombineMeanStd_pickle

# 需要導入模塊: from deepchem.models import TensorGraph [as 別名]
# 或者: from deepchem.models.TensorGraph import add_output [as 別名]
def test_CombineMeanStd_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = CombineMeanStd(in_layers=[feature, feature])
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()
開發者ID:AhlamMD,項目名稱:deepchem,代碼行數:10,代碼來源:test_layers_pickle.py


注:本文中的deepchem.models.TensorGraph.add_output方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。