cl.layers.dense(inputs, activation, num_outputs, out_caps_dims, routing_method='EMRouting', coordinate_addition=False, reuse=None, name=None)
A fully connected capsule layer.
inputs
: A 4-D tensor with shape [batch_size, num_inputs] + in_caps_dims or [batch_size, in_height, in_width, in_channels] + in_caps_dimsactivation
: [batch_size, num_inputs] or [batch_size, in_height, in_width, in_channels]num_outputs
: Integer, the number of output capsules in the layer.out_caps_dims
: A list with two elements, pose shape of output capsules.routing_method
: One of 'EMRouting' or 'DynamicRouting', the method for updating coupling coefficients between votes and posecoordinate_addition
: Boolean, whether use Coordinate Addition technique proposed by Hinton etc al., only works whenrouting_method
is EM Routing.
pose
: A 4-D tensor with shape [batch_size, num_outputs] + out_caps_dimsactivation
: [batch_size, num_outputs]
cl.layers.primaryCaps(inputs, filters, kernel_size, strides, out_caps_dims, method=None, name=None)
:
Primary capsule layer.
inputs
: [batch_size, in_height, in_width, in_channels].filters
: Integer, the dimensionality of the output space.kernel_size
: kernel_sizestrides
: stridesout_caps_dims
: A list of 2 integers.method
: the method of calculating probability of entity existence(logistic, norm, None)
pose
: A 6-D tensor, [batch_size, out_height, out_width, filters] + out_caps_dimsactivation
: A 4-D tensor, [batch_size, out_height, out_width, filters]
cl.layers.conv2d(inputs, activation, filters, out_caps_dims, kernel_size, strides, padding="valid", routing_method="EMRouting", name=None, reuse=None)
:
A 2D convolutional capsule layer.
inputs
: A 6-D tensor with shape [batch_size, in_height, in_width, in_channels] + in_caps_dims.activation
: A 4-D tensor with shape [batch_size, in_height, in_width, in_channels].filters
: Integer, the dimensionality of the output space (i.e. the number of filters in the convolution).out_caps_dims
: A tuple/list of 2 integers, specifying the dimensions of output capsule, e.g. out_caps_dims=[4, 4] representing that each output capsule has shape [4, 4].kernel_size
: An integer or tuple/list of 2 integers, specifying the height and width of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensstrides
: An integer or tuple/list of 2 integers, specifying the strides of the convolution along the height and width. Can be a single integer to specify the same value for all spatial dimpadding
: One of "valid" or "same" (case-insensitive), now only support "valid".routing_method
: One of "EMRouting" or "DynamicRouting", the method of routing-by-agreement algorithm.name
: A string, the name of the layer.reuse
: Boolean, whether to reuse the weights of a previous layer by the same name.
pose
: A 6-D tensor with shape [batch_size, out_height, out_width, out_channels] + out_caps_dims.activation
: A 4-D tensor with shape [batch_size, out_height, out_width, out_channels].
cl.layers.conv3d(inputs, activation, filters, out_caps_dims, kernel_size, strides, padding="valid", routing_method="EMRouting", name=None, reuse=None)
:
A 3D convolutional capsule layer.
inputs
: A 7-D tensor with shape [batch_size, in_depth, in_height, in_width, in_channels] + in_caps_dims.activation
: A 5-D tensor with shape [batch_size, in_depth, in_height, in_width, in_channels].filters
: Integer, the dimensionality of the output space (i.e. the number of filters in the convolution).out_caps_dims
: A tuple/list of 2 integers, specifying the dimensions of output capsule, e.g. out_caps_dims=[4, 4] representing that each output capsule has shape [4, 4].kernel_size
: An integer or tuple/list of 3 integers, specifying the height and width of the 3D convolution window. Can be a single integer to specify the same value for all spatial dimensstrides
: An integer or tuple/list of 3 integers, specifying the strides of the convolution along the height and width. Can be a single integer to specify the same value for all spatial dimpadding
: One of "valid" or "same" (case-insensitive), now only support "valid".routing_method
: One of "EMRouting" or "DynamicRouting", the method of routing-by-agreement algorithm.name
: String, a name for the operation (optional).reuse
: Boolean, whether to reuse the weights of a previous layer by the same name.
pose
: A 7-D tensor with shape [batch_size, out_depth, out_height, out_width, out_channels] + out_caps_dims.activation
: A 5-D tensor with shape [batch_size, out_depth, out_height, out_width, out_channels].
cl.layers.conv1d(inputs, activation, filters, out_caps_dims, kernel_size, stride, padding="valid", routing_method="EMRouting", name=None, reuse=None)
:
A 1D convolutional capsule layer (e.g. temporal convolution).
inputs
: A 5-D tensor with shape [batch_size, in_width, in_channels] + in_caps_dims.activation
: A 3-D tensor with shape [batch_size, in_width, in_channels].kernel_size
: An integer or tuple/list of a single integer, specifying the length of the 1D convolution window.strides
: An integer or tuple/list of a single integer, specifying the stride length of the convolution.
pose
: A 5-D tensor with shape [batch_size, out_width, out_channesl] + out_caps_dims.activation
: A 3-D tensor with shape [batch_size, out_width, out_channels].
labels
: [batch_size, num_label].logits
: [batch_size, num_label].margin
: Integer or 1-D Tensor.regularizer
: use regularization.
loss
: Spread loss.
labels
: [batch_size, num_label].logits
: [batch_size, num_label]