当前位置: 首页>>代码示例>>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;未经允许,请勿转载。