Ejemplo n.º 1
0
 def test_repetitions_increase_number_parameters(self):
   input_shape = (32, 32, 3)
   num_classes = 10
   small_resnet = resnet_models.create_resnet(
       input_shape, num_classes, repetitions=[1, 1])
   big_resnet = resnet_models.create_resnet(
       input_shape, num_classes, repetitions=[2, 2])
   self.assertLess(small_resnet.count_params(), big_resnet.count_params())
Ejemplo n.º 2
0
  def test_basic_fewer_parameters_than_bottleneck(self):
    input_shape = (32, 32, 3)
    num_classes = 10
    basic_resnet = resnet_models.create_resnet(
        input_shape, num_classes, block='basic')
    bottleneck_resnet = resnet_models.create_resnet(
        input_shape, num_classes, block='bottleneck')

    self.assertLess(basic_resnet.count_params(),
                    bottleneck_resnet.count_params())
Ejemplo n.º 3
0
 def test_group_norm_constructs(self):
   group_resnet = resnet_models.create_resnet(
       input_shape=(32, 32, 3), num_classes=10, norm='group')
   self.assertIsInstance(group_resnet, tf.keras.Model)
Ejemplo n.º 4
0
 def test_batch_norm_constructs(self):
   batch_resnet = resnet_models.create_resnet(
       input_shape=(32, 32, 3), num_classes=10, norm='batch')
   self.assertIsInstance(batch_resnet, tf.keras.Model)