checks

Module contents

poornn.checks.dec_check_shape(pos)

Check the shape of layer’s method.

Parameters:pos (tuple) – the positions of arguments to check shape.

Note

BUGGY.

Returns:a decorator.
Return type:func
poornn.checks.check_numdiff(layer, x=None, num_check=10, eta_x=None, eta_w=None, tol=0.001, var_dict={})

Random Numerical Differentiation check.

Parameters:
  • layer (Layer) – the layer under check.
  • x (ndarray|None, default=None) – input data, randomly generated if is None.
  • num_check (int, default=10) – number of random derivative checks for both inputs and weights.
  • eta_x (number, default=0.005 if float else 0.003+0.004j) – small change on input, in order to obtain numerical difference.
  • eta_w (number, default=0.005 if float else 0.003+0.004j) – small change on weight, in order to obtain numerical difference.
  • tol (float, default=1e-3) – tolerence, relative difference allowed with respect to max(|eta|, |gradient|).
  • var_dict (dict, default={}) – feed runtime variables if needed.
Returns:

test results, True for passed else False.

Return type:

list<bool>

poornn.checks.generate_randx(layer)

Generate random input tensor.

poornn.checks.check_shape_backward(f)

Check the shape of layer’s backward method.

Parameters:f (func) – backward method.

Note

BUGGY.

Returns:function decorator.
Return type:func
poornn.checks.check_shape_forward(f)

Check the shape of layer’s forward method.

Parameters:f (func) – forward method.

Note

BUGGY.

Returns:function decorator.
Return type:func
poornn.checks.check_shape_match(shape_get, shape_desire)

check whether shape_get matches shape_desire.

Parameters:
  • shape_get (tuple) – obtained shape.
  • shape_desire (tuple) – desired shape.
Returns:

tuple, the shape with more details.