Skip to content

API list

zzz233.to_pickle = to_pickle_wrapper() module-attribute

zzz233.from_pickle = from_pickle_wrapper() module-attribute

zzz233.to_np(x)

convert tensorflow/torch/cupy array to numpy array

Parameters:

Name Type Description Default
x array

array to be converted, could be tensorflow/torch/cupy/numpy array

required

Returns:

Name Type Description
ret array

converted array

zzz233.hfe(x, y, eps=1e-05)

calculate relative error

\[ f(x,y)=\max \frac{|x-y|}{|x|+|y|+\varepsilon} \]

Parameters:

Name Type Description Default
x array

array to be compared

required
y array

array to be compared

required

Returns:

Name Type Description
ret float

relative error

zzz233.moving_average(np0, num=3)

calculate moving average

Parameters:

Name Type Description Default
np0 array

array to be averaged

required
num int

number of elements to be averaged

3

Returns:

Name Type Description
ret array

averaged array

zzz233.check_internet_available(timeout=1)

check if internet is available (by trying to connect to google.com)

Parameters:

Name Type Description Default
timeout float

timeout in seconds

1

Returns:

Name Type Description
ret bool

True if internet is available, False otherwise