CIFAR-100 WideResNets¶
-
class
deepobs.cifar100.cifar100_wrn.set_up(batch_size, num_residual_units, k, weight_decay, bn_decay)[source]¶ Class providing the functionality for Wide Residual Networks on CIFAR-100.
The details of the architectures are described in the paper. This test problem is instantiated by the test problems cifar100_wrn404, et cetera.
TensorFlow code is adapted from here.
Parameters: - batch_size (int) -- Batch size of the data points. No default value specified.
- num_residual_units (int) -- Number of residual units in the network. No default value specified.
- k (int) -- Network width. No default value specified.
- weight_decay (float) -- Weight decay factor. In this model weight decay is applied to the weights, but not the biases. No default value specified.
- bn_decay (float) -- Decay factor for the moving average in the batch norm layer. No default value specified.
-
data_loading¶ Data loading class for CIFAR-100,
cifar100_input.data_loading.Type: deepobs.data_loading
-
losses¶ Tensor of size
batch_sizecontaining the individual losses per data point.Type: tf.Tensor
-
accuracy¶ Tensor containing the accuracy of the model.
Type: tf.Tensor
-
train_init_op¶ A TensorFlow operation to be performed before starting every training epoch.
Type: tf.Operation
-
train_eval_init_op¶ A TensorFlow operation to be performed before starting every training eval epoch.
Type: tf.Operation
-
test_init_op¶ A TensorFlow operation to be performed before starting every test evaluation phase.
Type: tf.Operation
-
batch_norm(x, phase, decay=0.9, name='batch_norm')[source]¶ Apply batch normalization to tensor x.
Parameters: - x (tf.Tensor) -- Input tensor to the batch norm layer.
- phase (tf.Variable) -- Phase variable switching between train and evaluation mode of the batch norm layer depending on its value ("train", "train_eval", "test").
- decay (float) -- Decay factor for the moving average in the batch norm layer. Defaults to
0.9. - name (str) -- Name for the layer. Defaults to
batch_norm.
Returns: Output after the batch norm layer.
Return type: tf.Variable
-
conv(x, filter_size, out_channels, stride, padding='SAME', name='conv')[source]¶ Apply a convolution to tensor
xwith a convolution kernel of shapefilter_size * filter_size * out_channels, as well as stride and padding as specified. The kernel is created/retrieved via tf.get_variable. No bias is added and no non-linearity is applied.Parameters: - x (tf.Tensor) -- Input tensor to the convolutional layer.
- filter_size (int) -- Size of the convolution. No default value specified.
- out_channels (int) -- Number of output channels after the conv layer.
- stride (int) -- Stride of the convolution. No default value specified.
- padding (int) -- Padding of the convolution. Can be
SAMEorVALID. Defaults toSAME. - name (str) -- Name of the layer. Defaults to
conv.
Returns: Output after the convolutional layer.
Return type: tf.Variable
-
fc(x, out_dim, name='fc')[source]¶ Apply a affine transformation (fully-connected layer) to tensor
xwith output dimensionout_dim. Weight matrix and bias vector are created/retrieved via tf.get_variable. No non-linearity is applied.Parameters: - x (tf.Tensor) -- Input tensor to the convolutional layer.
- out_dim (int) -- Number of output dimensions after the fully-connected layer.
- name (str) -- Name of the layer. Defaults to
fc.
Returns: Output after the fully-connected layer.
Return type: tf.Variable
-
get()[source]¶ Returns the losses and the accuray of the model.
Returns: Tupel consisting of the losses and the accuracy. Return type: tupel
-
set_up(num_residual_units, k, weight_decay, bn_decay)[source]¶ Sets up the test problem.
Parameters: - num_residual_units (int) -- Number of residual units in the network. No default value specified.
- k (int) -- Network width. No default value specified.
- weight_decay (float) -- Weight decay factor. In this model weight decay is applied to the weights, but not the biases. No default value specified.
- bn_decay (float) -- Decay factor for the moving average in the batch norm layer. No default value specified.
Returns: Tupel consisting of the losses and the accuracy.
Return type: tupel