Spaces:
Running
Running
File size: 896 Bytes
1f2f6bf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import * as tf from "@tensorflow/tfjs";
export interface BatchData {
xs: tf.Tensor2D;
labels: tf.Tensor2D;
}
export interface TestSample {
xs: tf.Tensor2D;
labels: tf.Tensor2D;
}
export class MnistData {
shuffledTrainIndex: number;
shuffledTestIndex: number;
numClasses: number;
numInputChannels: number;
trainSize: number;
testSize: number;
imageSize: number;
datasetImages: Float32Array;
datasetLabels: Uint8Array;
trainIndices: Uint32Array;
testIndices: Uint32Array;
trainImages: Float32Array;
testImages: Float32Array;
trainLabels: Uint8Array;
testLabels: Uint8Array;
load(): Promise<void>;
nextTrainBatch(batchSize: number): BatchData;
nextTestBatch(batchSize: number): BatchData;
nextBatch(
batchSize: number,
data: [Float32Array, Uint8Array],
index: () => number,
): BatchData;
getTestSample(index: number): TestSample;
}
|