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


Python ops.fc方法代碼示例

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


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

示例1: inception_v3_parameters

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def inception_v3_parameters(weight_decay=0.00004, stddev=0.1,
                            batch_norm_decay=0.9997, batch_norm_epsilon=0.001):
  """Yields the scope with the default parameters for inception_v3.

  Args:
    weight_decay: the weight decay for weights variables.
    stddev: standard deviation of the truncated guassian weight distribution.
    batch_norm_decay: decay for the moving average of batch_norm momentums.
    batch_norm_epsilon: small float added to variance to avoid dividing by zero.

  Yields:
    a arg_scope with the parameters needed for inception_v3.
  """
  # Set weight_decay for weights in Conv and FC layers.
  with scopes.arg_scope([ops.conv2d, ops.fc],
                        weight_decay=weight_decay):
    # Set stddev, activation and parameters for batch_norm.
    with scopes.arg_scope([ops.conv2d],
                          stddev=stddev,
                          activation=tf.nn.relu,
                          batch_norm_params={
                              'decay': batch_norm_decay,
                              'epsilon': batch_norm_epsilon}) as arg_scope:
      yield arg_scope 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:26,代碼來源:inception_model.py

示例2: testCreateFC

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFC(self):
    height, width = 3, 3
    with self.test_session():
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      output = ops.fc(inputs, 32)
      self.assertEquals(output.op.name, 'FC/Relu')
      self.assertListEqual(output.get_shape().as_list(), [5, 32]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:9,代碼來源:ops_test.py

示例3: testCreateFCWithScope

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFCWithScope(self):
    height, width = 3, 3
    with self.test_session():
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      output = ops.fc(inputs, 32, scope='fc1')
      self.assertEquals(output.op.name, 'fc1/Relu') 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:8,代碼來源:ops_test.py

示例4: testCreateFcCreatesWeightsAndBiasesVars

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFcCreatesWeightsAndBiasesVars(self):
    height, width = 3, 3
    inputs = tf.random_uniform((5, height * width * 3), seed=1)
    with self.test_session():
      self.assertFalse(variables.get_variables('fc1/weights'))
      self.assertFalse(variables.get_variables('fc1/biases'))
      ops.fc(inputs, 32, scope='fc1')
      self.assertTrue(variables.get_variables('fc1/weights'))
      self.assertTrue(variables.get_variables('fc1/biases')) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:11,代碼來源:ops_test.py

示例5: testReuseVars

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testReuseVars(self):
    height, width = 3, 3
    inputs = tf.random_uniform((5, height * width * 3), seed=1)
    with self.test_session():
      ops.fc(inputs, 32, scope='fc1')
      self.assertEquals(len(variables.get_variables('fc1')), 2)
      ops.fc(inputs, 32, scope='fc1', reuse=True)
      self.assertEquals(len(variables.get_variables('fc1')), 2) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:10,代碼來源:ops_test.py

示例6: testCreateFCWithoutActivation

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFCWithoutActivation(self):
    height, width = 3, 3
    with self.test_session():
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      output = ops.fc(inputs, 32, activation=None)
      self.assertEquals(output.op.name, 'FC/xw_plus_b') 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:8,代碼來源:ops_test.py

示例7: testCreateFCWithWD

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFCWithWD(self):
    height, width = 3, 3
    with self.test_session() as sess:
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      ops.fc(inputs, 32, weight_decay=0.01)
      wd = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)[0]
      self.assertEquals(wd.op.name,
                        'FC/weights/Regularizer/L2Regularizer/value')
      sess.run(tf.global_variables_initializer())
      self.assertTrue(sess.run(wd) <= 0.01) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:12,代碼來源:ops_test.py

示例8: testCreateFCWithoutWD

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFCWithoutWD(self):
    height, width = 3, 3
    with self.test_session():
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      ops.fc(inputs, 32, weight_decay=0)
      self.assertEquals(
          tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES), []) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:9,代碼來源:ops_test.py

示例9: testReuseFCWithWD

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testReuseFCWithWD(self):
    height, width = 3, 3
    with self.test_session():
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      ops.fc(inputs, 32, weight_decay=0.01, scope='fc')
      self.assertEquals(len(variables.get_variables()), 2)
      self.assertEquals(
          len(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)), 1)
      ops.fc(inputs, 32, weight_decay=0.01, scope='fc', reuse=True)
      self.assertEquals(len(variables.get_variables()), 2)
      self.assertEquals(
          len(tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)), 1) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:14,代碼來源:ops_test.py

示例10: testFCWithBatchNorm

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testFCWithBatchNorm(self):
    height, width = 3, 3
    with self.test_session():
      images = tf.random_uniform((5, height * width * 3), seed=1)
      with scopes.arg_scope([ops.fc], batch_norm_params={}):
        net = ops.fc(images, 27)
        net = ops.fc(net, 27)
      self.assertEquals(len(variables.get_variables()), 8)
      self.assertEquals(len(variables.get_variables('FC/BatchNorm')), 3)
      self.assertEquals(len(variables.get_variables('FC_1/BatchNorm')), 3) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:12,代碼來源:ops_test.py

示例11: testCreateFCWithWD

# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import fc [as 別名]
def testCreateFCWithWD(self):
    height, width = 3, 3
    with self.test_session() as sess:
      inputs = tf.random_uniform((5, height * width * 3), seed=1)
      ops.fc(inputs, 32, weight_decay=0.01)
      wd = tf.get_collection(tf.GraphKeys.REGULARIZATION_LOSSES)[0]
      self.assertEquals(wd.op.name,
                        'FC/weights/Regularizer/L2Regularizer/value')
      sess.run(tf.initialize_all_variables())
      self.assertTrue(sess.run(wd) <= 0.01) 
開發者ID:Cyber-Neuron,項目名稱:inception_v3,代碼行數:12,代碼來源:ops_test.py


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