functions¶
Module contents¶
-
poornn.functions.
wrapfunc
(func, dfunc, classname='GeneralFunc', attrs={}, docstring='', tags={}, real_out=False)¶ wrap a function and its backward counterpart into a
poornn.core.Function
layer.Parameters: - func (func) – forward function, take input (x, attrs) as parameters.
- dfunc (func) – derivative function, take input/output (x, y, **attrs) as parameters.
- classname (str) – function classname,
- attrs (dict) – attributes, and default input parameters.
- docstring (str) – the docstring of new class.
- tags (dict) – tags for this function, see poornn.core.TAG_LIST for detail.
- real_out (bool) – output data type is real for any input data type if True.
Returns: a dynamically generated layer type.
Return type: class
-
class
poornn.functions.
Log2cosh
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\log(2\cosh(x))\).
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Logcosh
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\log(\cosh(x))\).
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Sigmoid
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\frac{1}{1+\exp(-x)}\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Cosh
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\cosh(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Sinh
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\sinh(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Tan
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\tan(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Tanh
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\tanh(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Sum
(input_shape, itype, axis, **kwargs)¶ Bases:
poornn.core.Function
np.sum along
axis
.Parameters: axis (int) – the axis along which to sum over. -
axis
¶ int – the axis along which to sum over.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Mul
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\text{alpha}\cdot x\)
Parameters: alpha (int) – the multiplier. -
alpha
¶ int – the multiplier.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Mod
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=x\%n\)
Parameters: n (number) – the base. -
n
¶ number – the base.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Mean
(input_shape, itype, axis, **kwargs)¶ Bases:
poornn.core.Function
np.mean along
axis
.Parameters: axis (int) – the axis along which to operate. -
axis
¶ int – the axis along which to operate.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
FFT
(input_shape, itype, axis, kernel='fft', **kwargs)¶ Bases:
poornn.core.Function
scipy.fftpack.[fft|ifft|dct|idct|...] along
axis
.Parameters: - axis (int) – the axis along which to operate.
- kernel (str, default='fft') – the kernel used.
-
axis
¶ int – the axis along which to operate.
-
kernel
¶ str, default=’fft’ – the kernel used. refer scipy.fftpack for available kernels.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
ReLU
(input_shape, itype, leak=0.0, is_inplace=False, mode=None, **kwargs)¶ Bases:
poornn.core.Function
ReLU, for mode=’ri’,
\begin{align} f(x)=\text{relu}(x)=\begin{cases} x, &\Re[x]>0\land\Im[x]>0\\ \Re[x]+\text{leak}\cdot\Im[x],&\Re[x]>0\land\Im[x]<0\\ \Im[x]+\text{leak}\cdot\Re[x],&\Re[x]<0\land\Im[x]>0\\ \text{leak}\cdot x,&\Re[x]<0\land\Im[x]<0 \end{cases} \end{align}for mode=’r’,
\begin{align} f(x)=\text{relu}(x)=\begin{cases} x, &\Re[x]>0\\ \text{leak}\cdot x,&\Re[x]<0 \end{cases} \end{align}Parameters: - leak (float, default = 0.0) – leakage,
- mode ('ri'|'r', default='r' if itype is float else 'ri') – non-holomophic real-imaginary (ri) relu or holomophic real (r) relu
-
leak
¶ float – leakage,
-
mode
¶ ‘ri’|’r’ – non-holomophic real-imaginary (ri) relu or holomophic real (r) relu.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
ConvProd
(input_shape, itype, powers, strides=None, boundary='O', **kwargs)¶ Bases:
poornn.core.Function
Convolutional product layer, apply a kernel as powers to a subregion and make product over these elements.
Parameters: - powers (ndarray) – powers as a kernel.
- strides (tuple, default=(1, 1,..)) – stride for each dimension.
- boundary ('P'|'O', default='O') – Periodic/Open boundary condition.
-
powers
¶ ndarray – powers as a kernel.
-
strides
¶ tuple – stride for each dimension.
-
boundary
¶ ‘P’|’O’ – Periodic/Open boundary condition.
Note
For input array x, axes are aranged as (num_batch, nfi, img_in_dims), stored in ‘F’ order. For output array y, axes are aranged as (num_batch, nfo, img_out_dims), stored in ‘F’ order.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
img_nd
¶ int – dimension of image.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
Pooling
(input_shape, itype, kernel_shape, mode, **kwargs)¶ Bases:
poornn.core.Function
Pooling, see Pooling.mode_list for different types of kernels.
Parameters: - kernel_shape (tuple) – the shape of kernel.
- mode (str) – the strategy used for pooling,
- Pooling.mode_list for available modes. (refer) –
-
kernel_shape
¶ tuple – the shape of kernel.
-
mode
¶ str – the strategy used for pooling.
Note
For input array x, axes are aranged as (num_batch, nfi, img_in_dims), stored in ‘F’ order. For output array y, axes are aranged as (num_batch, nfo, img_out_dims), stored in ‘F’ order.
For complex numbers, what does max pooling looks like?
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
img_nd
¶ int – dimension of image.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
DropOut
(input_shape, itype, keep_rate, axis, is_inplace=False, **kwargs)¶ Bases:
poornn.core.Function
DropOut, take runtime variable seed.
Parameters: - axis (int) – the axis along which to operate.
- keep_rate (float) – the ratio of kept data.
-
axis
¶ int – the axis along which to operate.
-
keep_rate
¶ float – the ratio of kept data.
Example
>>> layer = DropOut((3, 3), 'complex128', keep_rate = 0.5, axis=-1) >>> layer.set_runtime_vars({'seed': 2}) >>> x = np.arange(9, dtype='complex128').reshape([3, 3], order='F') >>> print(layer.forward(x)) [[ 0.+0.j 6.+0.j 0.+0.j] [ 2.+0.j 8.+0.j 0.+0.j] [ 4.+0.j 10.+0.j 0.+0.j]]
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict)¶ Set the runtime variable seed, used to generate a random mask.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
Sin
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\sin(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Cos
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\cos(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
ArcTan
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\arctan(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Exp
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\exp(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Log
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\log(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
SoftPlus
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(log(1+exp(x))\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Power
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=x^{\rm order}\)
Parameters: order (number) – the order of power. -
order
¶ number – the order of power.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
SoftMax
(input_shape, itype, axis, scale=1.0, **kwargs)¶ Bases:
poornn.core.Function
Soft max function \(f(x)=\text{scale}\cdot\frac{\exp(x)}{\sum \exp(x)}\), with the sum performed over
axis
.Parameters: - axis (int) – the axis along which to operate.
- scale (number) – the factor to rescale output.
-
axis
¶ int – the axis along which to operate.
-
scale
¶ number, default = 1.0 – the factor to rescale output.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
CrossEntropy
(input_shape, itype, axis, **kwargs)¶ Bases:
poornn.core.Function
- Cross Entropy \(f(x)=\sum\text{y_true}\log(x)\),
- with y_true the true labels,
and the sum is performed over
axis
.
Parameters: axis (int) – the axis along which to operate. -
axis
¶ int – the axis along which to operate.
-
forward
(x, **kwargs)¶ Parameters: - x (ndarray) – satisfying \(0 < x \leq 1\).
- y_true (ndarray) – correct one-hot y.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
SoftMaxCrossEntropy
(input_shape, itype, axis, **kwargs)¶ Bases:
poornn.core.Function
Soft Max & Cross Entropy \(f(x)=\sum \text{y_true}\log(q)\), with y_true the true labels, and \(q=\frac{\exp(x)}{\sum \exp(x)}\), where the sum is performed over
axis
.Parameters: axis (int) – the axis along which to operate. -
axis
¶ int – the axis along which to operate.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
SquareLoss
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Square Loss \(f(x)=(x-\text{y_true})^2\). With p the true labels, requres runtime variable ‘y_true’.
-
y_true
¶ ndarray – the ‘correct’ output.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Reshape
(input_shape, output_shape, itype, dtype=None, otype=None, tags=None)¶ Bases:
poornn.core.Function
Change shape of data, reshape is performed in ‘F’ order.
Note
output_shape is a mandatory parameter now.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Transpose
(input_shape, itype, axes, **kwargs)¶ Bases:
poornn.core.Function
Transpose data flow.
Parameters: axes (tuple) – the target axes order. -
axes
¶ tuple – the target axes order.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
TypeCast
(input_shape, itype, otype, **kwargs)¶ Bases:
poornn.core.Function
Data type switcher.
Note
otype is a mandatory parameter now.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Filter
(input_shape, itype, momentum, axes, **kwargs)¶ Bases:
poornn.core.Function
Momentum Filter, single component fourier transformation. \(f(x)=\sum\limits_{n = 0}^{N-1}\exp(-i\pi k n/N)\cdot x[n]\), with index \(n\) iterate over
axes
.Parameters: - momentum (1darray) – the desired momentum.
- axes (tuple) – lattice axes over which to filter out component with the desired momentum.
-
momentum
¶ 1darray – the desired momentum.
-
axes
¶ tuple – lattice axes over which to filter out component with the desired momentum.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
BatchNorm
(input_shape, itype, eps=1e-08, axis=None, **kwargs)¶ Bases:
poornn.core.Function
Batch normalization layer.
Parameters: - axis (int|None, default = None) – batch axis over which we take norm.
- eps (float, default = 1e-8) – small number to avoid division to 0.
-
axis
¶ int|None – batch axis over which to calculate norm, if it is None, we don’t use any axis as batch, instead, we need to set mean and variance manually.
-
eps
¶ float – small number to avoid division to 0.
Note
shall we take mean and variance as run time variable?
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
Normalize
(input_shape, itype, axis, scale=1.0, **kwargs)¶ Bases:
poornn.core.Function
Normalize data, \(f(x)=\text{scale}\cdot x/\|x\|\), where the norm is performed over
axis
.Parameters: - axis (int) – axis over which to calculate norm.
- scale (number, default = 1.0) – the scaling factor.
-
axis
¶ int – axis over which to calculate norm.
-
scale
¶ number – the scaling factor.
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
class
poornn.functions.
Real
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\Re[x]\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Imag
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\Im[x]\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Conj
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=x^*\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Abs
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=|x|\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Abs2
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=|x|^2\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-
-
class
poornn.functions.
Angle
(input_shape, itype, **kwargs)¶ Bases:
poornn.core.Function
Function \(f(x)=\text{Arg}(x)\)
-
get_variables
()¶ Get variables, return empty (1d but with length - 0) array.
-
num_variables
¶ number of variables, which is fixed to 0.
-
set_runtime_vars
(var_dict={})¶ Set runtime variables for layers.
Parameters: var_dict (dict) – the runtime variables dict.
-
set_variables
(*args, **kwargs)¶ passed.
-