MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / loadHeaderValues

Function loadHeaderValues

fashion-mnist-vae/data.js:45–52  ·  view source on GitHub ↗

* Read the header of the dataset file * * @param {Buffer} buffer * @param {number} headerLength * * @returns {number[]} MNIST data header values

(buffer, headerLength)

Source from the content-addressed store, hash-verified

43 * @returns {number[]} MNIST data header values
44 */
45function loadHeaderValues(buffer, headerLength) {
46 const headerValues = [];
47 for (let i = 0; i < headerLength / 4; i++) {
48 // Header data is stored in-order (aka big-endian)
49 headerValues[i] = buffer.readUInt32BE(i * 4);
50 }
51 return headerValues;
52}
53
54/**
55 * Load the images from the given file and normalize the data to 0-1 range.

Callers 1

loadImagesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected