deepmd.tf.nvnmd.utils#
Submodules#
Attributes#
Classes#
Functions#
| |
| Build one layer with continuous or quantized value. |
| Mapping function implemented by numpy. |
| Get weight and bias of embedding network. |
| Get weight and bias of fitting network. |
Package Contents#
- deepmd.tf.nvnmd.utils.nvnmd_args(fold_subdoc: bool = False) dargs.Argument[source]#
- class deepmd.tf.nvnmd.utils.Encode[source]#
Encoding value as hex, bin, and dec format.
- qr(v: numpy.ndarray | float, nbit: int = 14) numpy.ndarray | float[source]#
Quantize value using round.
- qf(v: numpy.ndarray | float, nbit: int = 14) numpy.ndarray | float[source]#
Quantize value using floor.
- qc(v: numpy.ndarray | float, nbit: int = 14) numpy.ndarray | float[source]#
Quantize value using ceil.
- split_expo_mant(v: numpy.ndarray | float, min: int = -1000) tuple[numpy.ndarray | float, numpy.ndarray | float][source]#
- norm_expo(v: numpy.ndarray | float, nbit_frac: int = 20, expo_min: int = -1000) tuple[numpy.ndarray | float, float][source]#
- flt2bin(data: numpy.ndarray, nbit_expo: int, nbit_frac: int) list[str][source]#
Convert float into binary string list.
- byte2hex(bs: bytes, nbyte: int) list[str][source]#
Convert byte into hex bs: low byte in the first hex: low byte in the right.
- check_dec(idec: numpy.ndarray, nbit: int, signed: bool = False, name: str = '') None[source]#
Check whether the data (idec) is in the range range is \([0, 2^nbit-1]\) for unsigned range is \([-2^{nbit-1}, 2^{nbit-1}-1]\) for signed.
- extend_list(slbin: list[str], nfull: int) list[str][source]#
Extend the list (slbin) to the length (nfull) the attached element of list is 0.
such as, when
slbin = [‘10010’,’10100’],nfull = 4extent it to
[‘10010’,’10100’,’00000’,’00000]
- extend_bin(slbin: list[str], nfull: int) list[str][source]#
Extend the element of list (slbin) to the length (nfull).
such as, when
slbin = [‘10010’,’10100’],nfull = 6extent to
[‘010010’,’010100’]
- extend_hex(slhex: list[str], nfull: int) list[str][source]#
Extend the element of list (slhex) to the length (nfull).
- split_bin(sbin: str | list[str], nbit: int) list[str][source]#
Split sbin into many segment with the length nbit.
- reverse_bin(slbin: list[str], nreverse: int) list[str][source]#
Reverse binary string list per nreverse value.
- merge_bin(slbin: list[str], nmerge: int) list[str][source]#
Merge binary string list per nmerge value.
- dec2bin(idec: numpy.ndarray | float, nbit: int = 10, signed: bool = False, name: str = '') list[str][source]#
Convert dec array to binary string list.
- class deepmd.tf.nvnmd.utils.FioBin[source]#
Input and output for binary file.
- class deepmd.tf.nvnmd.utils.FioDic[source]#
Input and output for dict class data the file can be .json or .npy file containing a dictionary.
- class deepmd.tf.nvnmd.utils.FioTxt[source]#
Input and output for .txt file with string.
- deepmd.tf.nvnmd.utils.one_layer(inputs: deepmd.tf.env.tf.Tensor, outputs_size: int, activation_fn: Callable | None = tf.nn.tanh, precision: deepmd.tf.env.tf.DType = GLOBAL_TF_FLOAT_PRECISION, stddev: float = 1.0, bavg: float = 0.0, name: str = 'linear', reuse: bool | None = None, seed: int | None = None, use_timestep: bool = False, trainable: bool = True, useBN: bool = False, uniform_seed: bool = False, initial_variables: dict | None = None, mixed_prec: dict | None = None, final_layer: bool = False) deepmd.tf.env.tf.Tensor[source]#
Build one layer with continuous or quantized value. Its weight and bias can be initialed with random or constant value.
- deepmd.tf.nvnmd.utils.map_nvnmd(x: float, map_y: numpy.ndarray, map_dy: numpy.ndarray, prec: float, nbit: int | None = None) float[source]#
Mapping function implemented by numpy.
- deepmd.tf.nvnmd.utils.get_filter_weight(weights: int, spe_j: int, layer_l: int) tuple[source]#
Get weight and bias of embedding network.