loredart_nn library

Classes

Activation
The activations base class.
ActivationLayer
A layer that applies an element-wise activation function.
Activations
Collection of possible activation function.
AdaBelief
Optimizer that implements the AdaBelief algorithm, derived from a paper.
Adam
Optimizer that implements the Adam algorithm, derived from a paper.
AveragePool1D
1D Average Pooling layer.
AveragePool2D
2D Average Pooling layer.
BinaryAccuracyMetric
The binary accuracy metric.
BinaryCrossentropy
The crossentropy loss between (binary) true labels and predicted labels.
BinaryCrossentropyMetric
The binary crossentropy between labels and predictions.
CategoricalAccuracyMetric
The accuracy metric.
CategoricalCrossentropy
The crossentropy loss between true labels and predicted labels.
CategoricalCrossentropyMetric
The crossentropy between labels and predictions.
Constant
Initializer that generates tensors with constant value.
Conv1D
1D Convolution layer
Conv2D
2D Convolution layer
Dense
A regular fully-connected layer.
Dropout
Implements the Dropout regularization technique.
ELU
Exponential Linear Unit (ELU) activation function.
Flatten
A layer that flattens the input tensor into a 1-dimensional output.
Float32NumericTensor
NumericTensor with float32 values stored in Float32List.
Float64NumericTensor
NumericTensor with float64 values stored in Float64List.
GlobalAveragePool1D
1D Global Average Pooling layer
GlobalAveragePool2D
2D Global Average Pooling layer
GlobalMaxPool1D
1D Global Max Pooling layer
GlobalMaxPool2D
2D Global Max Pooling layer
GlorotNormal
The Glorot normal variance scaler initializer.
GlorotUniform
The Glorot uniform variance scaler initializer.
HeNormal
The He normal variance scaler initializer.
HeUniform
The He uniform variance scaler initializer.
Identity
Initializer that generates identity matrices.
Initializer
The base class for initializers.
Initializers
Collection of initializers.
Int32NumericTensor
NumericTensor with int32 values stored in Int32List.
Int64NumericTensor
NumericTensor with int64 values stored in Int64List.
KLDivergenceMetric
The Kullback-Leibler divergence metric between true and predicted values.
Layer
The base class for model layer - a callable module that performs a computation on a single Tensor and outputs a single Tensor.
LayerNormalization
Layer normalization layer *.
LeakyReLU
Leaky ReLU activation function.
Linear
Linear activation function.
Lion
Optimizer that implements the Lion algorithm, derived from a project.
LogCoshError
The logarithm of the hyperbolic cosine of errors between labels and predictions.
LogCoshErrorMetric
The log cosh error between labels and predictions.
Loss
The loss base class.
MaxPool1D
1D Max Pooling layer.
MaxPool2D
2D Max Pooling layer.
MeanAbsoluteError
The mean of absolute difference between labels and predictions.
MeanAbsoluteErrorMetric
The mean absolute error between labels and predictions.
MeanMetric
Metric that compute mean of accumulated states.
MeanSquaredError
The mean of squares of errors between labels and predictions.
MeanSquaredErrorMetric
The mean squared error between labels and predictions.
Metric
Base class for representing a metric for evaluating model performance.
Metrics
The collection of supported metrics.
Model
A Model is a complete neural network made up of an ordered list of Layers.
NumericTensor<L extends List>
A Tensor with numeric elements and dType.
Ones
Initializer that generates tensors with 1
Optimizer
The optimizer base class.
ReLU
Rectified Linear Unit (ReLU) activation function.
Rescale
A simple layer that rescales and offsets the input tensor by a constant amount.
Reshape
Layer that reshapes an output to a new shape.
RootMeanSquaredErrorMetric
The root of mean squared error between labels and predictions.
SGD
The (mini-batched) gradient descent with momentum and weight decay.
Sigmoid
Sigmoid activation function.
Softmax
Softmax activation function.
Softminus
Softminus activation function.
Softplus
Softplus activation function.
SparseCategoricalAccuracyMetric
The sparse version of accuracy metric.
SparseCategoricalCrossentropy
The crossentropy loss between true labels and predicted labels.
SparseCategoricalCrossentropyMetric
The sparse version of crossentropy between labels and predictions.
Swish
Swish activation function.
Tanh
Hyperbolic tangent activation function.
Tensor
The representation of a multidimensional array of elements of a single type.
TensorShape
The shape of a Tensor.
Uint8NumericTensor
NumericTensor with uint8 values stored in Uint8List.
VarianceScaler
Initializer that adapts its scale to tensors' shapes.
Zeros
Initializer that generates tensors with 0.

Enums

Distribution
DType
The data types of the elements in a Tensor.
FanMode
Reduction
Type of loss reduction.

Extensions

DTypeTypes on DType
The types of the DType data types.

Constants

defaultTypesToDTypes → const Map<Type, DType>
Default correspondence of Dart Types and tensors' DType.

Functions

abs(Tensor x) → Tensor
Computes absolute value of x element-wise.
acos(Tensor x) → Tensor
Computes arc cosine of x element-wise.
apply(Tensor x, num func(num), {DType? dType}) → Tensor
Applies func on x element-wise.
argMax(Tensor x, {int axis = 0, DType dType = DType.int32}) → Tensor
Returns the indices with the largest elements across the dimension given in the axis of a tensor x.
asin(Tensor x) → Tensor
Computes arc sine of x element-wise.
atan(Tensor x) → Tensor
Computes arc tan of x element-wise.
avgPool1D(Tensor input, int kSize, {List<int> strides = const [1, 1, 1], Padding padding = Padding.valid}) → Tensor
Performs 1D averaging pooling of 3D input across spatial dim with window of size kSize.
avgPool2D(Tensor input, List<int> kSize, {List<int> strides = const [1, 1, 1, 1], Padding padding = Padding.valid}) → Tensor
Performs 2D averaging pooling of 4D input across spatial dims with window of size kSize.
binaryCrossentropy(Tensor yTrue, Tensor yPred, {List<int> axis = const [-1], double epsilon = 1e-7}) → Tensor
Computes the binary crossentropy between equal-shaped Tensors yTrue and yPred along given axis.
cast(Tensor x, DType dType) → Tensor
Casts x to a dType.
clipByValue(Tensor x, dynamic minValue, dynamic maxValue) → Tensor
Clips x to a specific minValue and maxValue.
concat(List<Tensor> tensors, {int axis = -1}) → Tensor
Concatenates Tensors from tensors along one given axis.
conv1D(Tensor input, Tensor filter, {List<int> strides = const [1, 1, 1], Padding padding = Padding.valid}) → Tensor
Computes a 1D convolution of given 3D input with 3D filter.
conv2D(Tensor input, Tensor filter, {List<int> strides = const [1, 1, 1, 1], Padding padding = Padding.valid}) → Tensor
Computes a 2D convolution of given 4D input with 4D filter.
cos(Tensor x) → Tensor
Computes cosine of x element-wise.
cosh(Tensor x) → Tensor
Computes hyperbolic cosine of x element-wise.
crossEntropy(Tensor yTrue, Tensor yPred, {List<int> axis = const [-1], double epsilon = 1e-7}) → Tensor
Computes the crossentropy between equal-shaped Tensors yTrue and yPred along given axis.
dropout(Tensor x, double rate, {List<int>? noiseShape, int? seed}) → Tensor
Computes the dropout of x, i.e., with probability rate set each element to zero. Remaining non-dropped elements are scaled by 1/(1-rate) to preserve the mean.
dropoutWithMask(Tensor x, double rate, {List<int>? noiseShape, int? seed}) → List<Tensor>
Computes the dropout of x and additionally returns dropout mask. For explanation see dropout function.
elu(Tensor x, double alpha) → Tensor
Applies the ELU activation function (with alpha) to the elements of x.
emptyBuffer(DType dType, int length) → List
Returns an empty buffer list of the given length according to the dType.
equal(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x == y element-wise, represented as 1 for true and 0 for false.
exp(Tensor x) → Tensor
Computes exponent of x element-wise.
expandDims(Tensor x, int axis) → Tensor
Adds extra dim of length 1 into x at index axis.
expm1(Tensor x) → Tensor
Computes e^x-1 element-wise.
greater(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x > y element-wise, represented as 1 for true and 0 for false.
greaterEqual(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x >= y element-wise, represented as 1 for true and 0 for false.
klDivergence(Tensor yTrue, Tensor yPred, {List<int> axis = const [-1], double epsilon = 1e-7}) → Tensor
Computes the Kullback-Leibler divergence between equal-shaped Tensors yTrue and yPred along given axis.
leakyReLU(Tensor x, double alpha) → Tensor
Applies the LeakyReLU activation function (with alpha) to the elements of x.
less(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x < y element-wise, represented as 1 for true and 0 for false.
lessEqual(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x <= y element-wise, represented as 1 for true and 0 for false.
log(Tensor x) → Tensor
Computes the natural logarithm of x element-wise.
log1p(Tensor x) → Tensor
Computes the natural logarithm of (1+x) element-wise.
log2(Tensor x) → Tensor
Computes the binary logarithm of x element-wise.
logCosh(Tensor yTrue, Tensor yPred, {List<int> axis = const [-1]}) → Tensor
Computes the logarithm of the hyperbolic cosine of differences between equal-shaped Tensors yTrue and yPred along given axis.
matmul(Tensor a, Tensor b, {bool transposeA = false, bool transposeB = false}) → Tensor
Multiplies matrix a by matrix b.
matrixTranspose(Tensor x) → Tensor
Transposes last two dimensions of x.
max(Tensor x, Tensor y) → Tensor
Computes max of x and y element-wise.
maximum(Tensor x) → Tensor
Computes max of x.
maxPool1D(Tensor input, int kSize, {List<int> strides = const [1, 1, 1], Padding padding = Padding.valid}) → Tensor
Performs 1D max pooling of 3D input across spatial dim with window of size kSize.
maxPool2D(Tensor input, List<int> kSize, {List<int> strides = const [1, 1, 1, 1], Padding padding = Padding.valid}) → Tensor
Performs 2D max pooling of 4D input across spatial dims with window of size kSize.
mean(Tensor x, {DType? dType}) → Tensor
Computes mean of x.
min(Tensor x, Tensor y) → Tensor
Computes min of x and y element-wise.
minimum(Tensor x) → Tensor
Computes min of x.
normal(List<int> shape, {num mean = 0.0, num std = 1.0, DType dType = DType.float32, int? seed}) → Tensor
Outputs Tensor of given shape with random values from a normal distribution with mean mean and standard deviation std.
notEqual(Tensor x, dynamic y) → Tensor
Returns the "truth" value of x <= y element-wise, represented as 1 for true and 0 for false.
oneHotTensor(Tensor indices, {required int depth, num onValue = 1.0, num offValue = 0.0, int axis = -1, DType? dType}) → Tensor
Constructs and returns one-hot tensor.
pad(Tensor x, Tensor padding, {num value = 0.0}) → Tensor
Pads tensor x with value according to the padding scheme.
pool1D(Tensor input, int kSize, {PoolingType type = PoolingType.max, required List<int> strides, required Padding padding}) → Tensor
Computes a 1D pooling of given 3D input with 1D window of size kSize.
pool2D(Tensor input, List<int> kSize, {PoolingType type = PoolingType.max, required List<int> strides, required Padding padding}) → Tensor
Computes a 2D pooling of given 4D input with 2D window of size kSize.
pow(Tensor x, Object exponent) → Tensor
Computes x to the power of exponent element-wise.
reduceLocalArgMax(Tensor x, {List<int>? axis, bool keepDims = false}) → Tensor
Returns the local indices with the largest elements across dimensions given in the axis of a tensor x.
reduceMax(Tensor x, {List<int>? axis, bool keepDims = false}) → Tensor
Computes max of elements across dimensions given in the axis of a tensor x.
reduceMean(Tensor x, {List<int>? axis, bool keepDims = false, DType? dType}) → Tensor
Computes the mean of elements across dimensions given in the axis of a tensor x.
reduceMin(Tensor x, {List<int>? axis, bool keepDims = false}) → Tensor
Computes min of elements across dimensions given in the axis of a tensor x.
reduceProd(Tensor x, {List<int>? axis, bool keepDims = false}) → Tensor
Computes the product of elements across dimensions given in the axis of a tensor x.
reduceStd(Tensor x, {List<int>? axis, bool keepDims = false, DType? dType}) → Tensor
Computes the standard deviation of elements across dimensions given in the axis of a tensor x.
reduceSum(Tensor x, {List<int>? axis, bool keepDims = false}) → Tensor
Computes the sum of elements across dimensions given in the axis of a tensor x.
reduceVariance(Tensor x, {List<int>? axis, bool keepDims = false, DType? dType}) → Tensor
Computes the variance of elements across dimensions given in the axis of a tensor x.
relu(Tensor x) → Tensor
Applies the ReLU activation function to the elements of x.
reshape(Tensor x, List<int> shape) → Tensor
Reshapes a tensor x with new shape.
sech(Tensor x) → Tensor
Computes hyperbolic sec of x element-wise.
sigmoid(Tensor x) → Tensor
Computes sigmoid of x element-wise.
sign(Tensor x) → Tensor
Computes an element-wise indication of the sign of x.
sin(Tensor x) → Tensor
Computes sine of x element-wise.
sinh(Tensor x) → Tensor
Computes hyperbolic sine of x element-wise.
slice(Tensor x, List<int> begin, List<int> end) → Tensor
Extracts and returns strode slice of the tensor x from begin (inclusively) to end (exclusively).
softmax(Tensor x, {int axis = -1, bool? stable}) → Tensor
Applies the softmax activation function to the x along axis.
softminus(Tensor x) → Tensor
Computes softminus of x element-wise.
softplus(Tensor x) → Tensor
Computes softplus of x element-wise.
splitToFeaturesAndTargets(Tensor values, {required List<int> targetIndices, DType? targetsDType, DType? featuresDType}) → (Tensor, Tensor)
Splits input Tensor into two (feature and targets) by columns and optionally casts any of those into specific DTypes.
sqrt(Tensor x) → Tensor
Computes the positive square of x element-wise.
square(Tensor x) → Tensor
Computes square of x element-wise.
squareDifference(Tensor x, Tensor y) → Tensor
Computes (x-y)^2 element-wise.
squeeze(Tensor x, {List<int>? axis}) → Tensor
Removes dimensions of size 1 from the shape of a x.
tan(Tensor x) → Tensor
Computes tan of x element-wise.
tanh(Tensor x) → Tensor
Computes hyperbolic tan of x element-wise.
tensorFromBytes(List<int> bytes) → Tensor
Constructs a Tensor from bytes.
tensorFromJson(Map<String, dynamic> data) → Tensor
Constructs a Tensor from a Map data structure.
tensorToBytes(Tensor tensor) → List<int>
Converts tensor into a sequence of raw bytes.
tensorToJson(Tensor tensor) → Map<String, dynamic>
Converts tensor into a json-encodable Map.
truncatedNormal(List<int> shape, {num mean = 0.0, num std = 1.0, DType dType = DType.float32, int? seed}) → Tensor
Outputs Tensor of given shape with random values from a truncated normal distribution.
uniform(List<int> shape, {num min = 0.0, num max = 1.0, DType dType = DType.float32, int? seed}) → Tensor
Outputs Tensor of given shape with random values from a uniform distribution.
variance(Tensor x, {DType? dType}) → Tensor
Computes variance of x.
xlog1py(Tensor x, Tensor y) → Tensor
Computes x*log(y+1) element-wise.
xlogy(Tensor x, Tensor y) → Tensor
Computes x*log(y) element-wise.

Typedefs

History = Map<String, List<num>>
History of loss and metrics during training epochs