orcanet.builder_util.builders
Module Contents
Classes
Builds single-input block-wise sequential neural network. |
Functions
|
Build input layers according to a dict mapping the layer names to shapes. |
- class orcanet.builder_util.builders.BlockBuilder(defaults=None, verbose=False, input_opts=None, **kwargs)[source]
Builds single-input block-wise sequential neural network.
- Parameters
- defaultsdict or None
Default values for all blocks in the model.
- verbosebool
Print info about the building process?
- batch_sizeint, optional
Define a fixed batchsize for the input.
- build(input_shape, configs)[source]
Build the whole model, using the default values when arguments are missing in the layer_configs.
- Parameters
- input_shapedict
Name and shape of the input layer.
- configslist
List of configurations for the blocks in the model. Each element in the list is a dict and will result in one block connected to the previous one. The dict has to contain the type of the block, as well as any arguments required by that specific block type.
- Returns
- modelkeras model
- attach_block(layer, layer_config)[source]
Attach a block to the given layer based on the layer config.
Will use the default values given during initialization if they are not present in the layer config.
- Parameters
- layerkeras layer
Layer to attach the block to.
- layer_configdict
Configuration of the block to attach. The dict has to contain the type of the block, as well as any arguments required by that specific block.
- Returns
- keras layer
- orcanet.builder_util.builders.get_input_block(input_shapes, batchsize=None, names=None)[source]
Build input layers according to a dict mapping the layer names to shapes. If none appears in shape, input is ragged.
- Parameters
- input_shapesdict
Keys: Input layer names. Values: Their shapes.
- batchsizeint, optional
Specify fixed batchsize.
- namestuple, optional
Make sure the inputs are these names and return them in this order.
- Returns
- inputstf.Tensor or tuple
A list of named keras input layers, or the input Tensor if there is only one input.