convert_kernel

convert_kernel(kernel, dim_ordering=None)

Converts a Numpy kernel matrix from Theano format to TensorFlow format.

Also works reciprocally, since the transformation is its own inverse.

Arguments

  • kernel: Numpy array (4D or 5D).
  • dim_ordering: the data format.

Returns

The converted kernel.

Raises

  • ValueError: in case of invalid kernel shape or invalid dim_ordering.

conv_output_length

conv_output_length(input_length, filter_size, border_mode, stride, dilation=1)

Determines output length of a convolution given input length.

Arguments

  • input_length: integer.
  • filter_size: integer.
  • border_mode: one of "same", "valid", "full".
  • stride: integer.
  • dilation: dilation rate, integer.

Returns

The output length (integer).


conv_input_length

conv_input_length(output_length, filter_size, border_mode, stride)

Determines input length of a convolution given output length.

Arguments

  • output_length: integer.
  • filter_size: integer.
  • border_mode: one of "same", "valid", "full".
  • stride: integer.

Returns

The input length (integer).


to_categorical

to_categorical(y, nb_classes=None)

Converts a class vector (integers) to binary class matrix.

E.g. for use with categorical_crossentropy.

Arguments

  • y: class vector to be converted into a matrix (integers from 0 to nb_classes).
  • nb_classes: total number of classes.

Returns

A binary matrix representation of the input.