federer
Version:
Experiments in asynchronous federated learning and decentralized learning
30 lines • 1.31 kB
TypeScript
import { PreprocessFn } from "./PreprocessPipeline";
/**
* Encodes labels as one-hot vectors
*
* @param numberLabelClasses Number of different labels. Determines the length
* of the one-hot vector returned by the returned function.
*
* @returns A function that takes a 1D tensor of labels, and returns this tensor
* encoded as a 2D one-hot tensor. Note that the values in the 1-D tensor must
* be integers in the range `[0, numberLabelClasses]`.
*/
export declare const oneHotLabels: (numberLabelClasses: number) => PreprocessFn;
/**
* Linearly map values of a tensor from an input range to an output range
*
* @param inputRange Range of values in the input tensor
* @param outputRange Range of values in the output tensor
* @returns A function that takes a tensor with values in `inputRange`, and that
* returns a tensor with values mapped onto the range `outputRange`
*/
export declare const mapValuesToRange: (inputRange: [number, number], outputRange: [number, number]) => PreprocessFn;
/**
* Flatten a list of items into a list of flat items.
*
* @param items Tensor representing a list of items, where items may be multi-
* dimensional.
* @returns Tensor representing a list of flat items
*/
export declare const flattenItems: PreprocessFn;
//# sourceMappingURL=preprocess.d.ts.map