deephyper.nas.space.op package

Submodules

deephyper.nas.space.op.basic module

class deephyper.nas.space.op.basic.Operation(layer: tensorflow.python.keras.engine.base_layer.Layer)[source]

Bases: object

Interface of an operation.

>>> import tensorflow as tf
>>> from deephyper.nas.space.op.op1d import Operation
>>> Operation(layer=tf.keras.layers.Dense(10))
Dense
Parameters

layer (Layer) – a tensorflow.keras.layers.Layer.

init(current_node)[source]

Preprocess the current operation.

class deephyper.nas.space.op.basic.Tensor(tensor, *args, **kwargs)[source]

Bases: deephyper.nas.space.op.basic.Operation

class deephyper.nas.space.op.basic.Zero[source]

Bases: deephyper.nas.space.op.basic.Operation

deephyper.nas.space.op.cnn module

Operations corresponding to convolution neural networks.

Learn more about different kind of convolution : https://towardsdatascience.com/types-of-convolutions-in-deep-learning-717013397f4d

class deephyper.nas.space.op.cnn.AvgPool2D(pool_size, strides=1, padding='same', num_filters=32)[source]

Bases: deephyper.nas.space.op.basic.Operation

Average pooling with 2 dimensions.

Create a 2 dimensions average pooling operation. https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/AveragePooling2D

Parameters
  • kernel_height (int) –

  • kernel_width (int) –

  • stride_height (int) –

  • stride_width (int) –

  • padding (string) – ‘SAME’ or ‘VALID’

  • num_filters (int) – corresponding to the number of filters we need the output to have

class deephyper.nas.space.op.cnn.Conv2D(kernel_size, filters=8, strides=1, padding='SAME', dilation_rate=1, activation=None)[source]

Bases: deephyper.nas.space.op.basic.Operation

Classic convolution with 2 dimensions.

Create a 2 dimensions classic convolution operation. https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/Conv2D

Parameters
  • filter_height (int) – height of a filter or kernel.

  • filter_width (int) – width of a filter or kernel.

  • num_filters (int) – number of filters in the convolution operation.

class deephyper.nas.space.op.cnn.MaxPool2D(pool_size, strides=1, padding='same', num_filters=32)[source]

Bases: deephyper.nas.space.op.basic.Operation

Max pooling with 2 dimensions.

Create a 2 dimensions max pooling operation. https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/MaxPool2D

Parameters
  • kernel_height (int) –

  • kernel_width (int) –

  • stride_height (int) –

  • stride_width (int) –

  • padding (string) – ‘SAME’ or ‘VALID’

  • num_filters (int) – corresponding to the number of filters we need the output to have

class deephyper.nas.space.op.cnn.SeparableConv2D(kernel_size, filters=8, strides=1, padding='same')[source]

Bases: deephyper.nas.space.op.basic.Operation

Depthwise-separable convolution with 2 dimensions.

Create a 2 dimensions depthwise-separable convolution operation. https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/layers/SeparableConv2D

Parameters
  • filter_height (int) – height of a filter or kernel.

  • filter_width (int) – width of a filter or kernel.

  • num_filters (int) – number of filters in the convolution operation.

deephyper.nas.space.op.connect module

class deephyper.nas.space.op.connect.Connect(search_space, source_node, *args, **kwargs)[source]

Bases: deephyper.nas.space.op.basic.Operation

Connection node.

Represents a possibility to create a connection between n1 -> n2.

Parameters
  • graph (nx.DiGraph) – a graph

  • source_node (Node) – source

init(current_node)[source]

Set the connection in the search_space graph from [n1] -> n2.

deephyper.nas.space.op.merge module

class deephyper.nas.space.op.merge.AddByPadding(search_space, stacked_nodes=None, activation=None, axis=- 1)[source]

Bases: deephyper.nas.space.op.basic.Operation

Add operation. If tensor are of different shapes a padding will be applied before adding them.

Parameters
  • search_space (KSearchSpace) – [description]. Defaults to None.

  • activation ([type], optional) – Activation function to apply after adding (‘relu’, tanh’, ‘sigmoid’…). Defaults to None.

  • stacked_nodes (list(Node)) – nodes to add.

  • axis (int) – axis to concatenate.

init(current_node)[source]

Preprocess the current operation.

class deephyper.nas.space.op.merge.AddByProjecting(search_space, stacked_nodes=None, activation=None, axis=- 1)[source]

Bases: deephyper.nas.space.op.basic.Operation

Add operation. If tensors are of different shapes a projection will be applied before adding them.

Parameters
  • search_space (KSearchSpace) – [description]. Defaults to None.

  • activation ([type], optional) – Activation function to apply after adding (‘relu’, tanh’, ‘sigmoid’…). Defaults to None.

  • stacked_nodes (list(Node)) – nodes to add.

  • axis (int) – axis to concatenate.

init(current_node)[source]

Preprocess the current operation.

class deephyper.nas.space.op.merge.Concatenate(search_space, stacked_nodes=None, axis=- 1)[source]

Bases: deephyper.nas.space.op.basic.Operation

Concatenate operation.

Parameters
  • graph

  • node (Node) –

  • stacked_nodes (list(Node)) – nodes to concatenate

  • axis (int) – axis to concatenate

init(current_node)[source]

Preprocess the current operation.

deephyper.nas.space.op.op1d module

class deephyper.nas.space.op.op1d.Activation(activation=None, *args, **kwargs)[source]

Bases: deephyper.nas.space.op.basic.Operation

Activation function operation.

Parameters

activation (callable) – an activation function

class deephyper.nas.space.op.op1d.Conv1D(filter_size, num_filters=1, strides=1, padding='same')[source]

Bases: deephyper.nas.space.op.basic.Operation

Convolution for one dimension.

Help you to create a one dimension convolution operation.

Parameters
  • filter_size (int) – size kernels/filters

  • num_filters (int) – number of kernels/filters

  • strides (int) –

  • padding (str) – ‘same’ or ‘valid’

class deephyper.nas.space.op.op1d.Dense(units, activation=None, *args, **kwargs)[source]

Bases: deephyper.nas.space.op.basic.Operation

Multi Layer Perceptron operation.

Help you to create a perceptron with n layers, m units per layer and an activation function.

Parameters
  • units (int) – number of units per layer.

  • activation – an activation function from tensorflow.

class deephyper.nas.space.op.op1d.Dropout(rate)[source]

Bases: deephyper.nas.space.op.basic.Operation

Dropout operation.

Help you to create a dropout operation.

Parameters

rate (float) – rate of deactivated inputs.

class deephyper.nas.space.op.op1d.Flatten(data_format=None)[source]

Bases: deephyper.nas.space.op.basic.Operation

Flatten operation.

Parameters

data_format (str, optional) – Defaults to None.

class deephyper.nas.space.op.op1d.Identity[source]

Bases: deephyper.nas.space.op.basic.Operation

class deephyper.nas.space.op.op1d.MaxPooling1D(pool_size, strides=1, padding='valid', data_format='channels_last')[source]

Bases: deephyper.nas.space.op.basic.Operation

MaxPooling over one dimension.

Parameters
  • pool_size ([type]) – [description]

  • strides (int, optional) – Defaults to 1. [description]

  • padding (str, optional) – Defaults to ‘valid’. [description]

  • data_format (str, optional) – Defaults to ‘channels_last’. [description]

Module contents