das.morpholayers.constraints#

class das.morpholayers.constraints.Diamond[source]#

Constrains weights to a diamond shape (only for square filters).

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.Disk[source]#

Constrains weights to a disk shape (only for square filters).

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.Lattice[source]#

Constrains weights to be within a lattice range.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.NonPositive[source]#

Constrains weights to be non-positive values.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.NonPositiveExtensive[source]#

Constrains weights to be non-positive and centers equal to zero.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.Rounding(c=4)[source]#

Constrains weights by rounding them to specified decimal places.

Parameters

c (int) – Number of decimal places for rounding.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.SEconstraint(SE=array([[0, 1, 0], [1, 1, 1], [0, 1, 0]], dtype=uint8))[source]#

Constrains weights to any structured element (SE) shape.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

class das.morpholayers.constraints.ZeroToOne[source]#

Constrains weights to be between 0 and 1.

get_config()[source]#

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can be used to reinstantiate the same object.

Returns

Python dict containing the configuration of the constraint object.

das.morpholayers.constraints.rounding_op1(x)[source]#

Round the input tensor to the nearest tenth.

Parameters

x (tf.Tensor) – Input tensor.

Returns

Rounded tensor.

Return type

tf.Tensor

das.morpholayers.constraints.rounding_op2(x)[source]#

Round the input tensor to the nearest hundredth.

Parameters

x (tf.Tensor) – Input tensor.

Returns

Rounded tensor.

Return type

tf.Tensor

das.morpholayers.constraints.rounding_op3(x)[source]#

Round the input tensor to the nearest thousandth.

Parameters

x (tf.Tensor) – Input tensor.

Returns

Rounded tensor.

Return type

tf.Tensor

das.morpholayers.constraints.rounding_op4(x)[source]#

Round the input tensor to the nearest ten-thousandth.

Parameters

x (tf.Tensor) – Input tensor.

Returns

Rounded tensor.

Return type

tf.Tensor