Skip to content

Commit

Permalink
TypeScript hates me today
Browse files Browse the repository at this point in the history
  • Loading branch information
voidvoxel committed Jun 17, 2024
1 parent 51b9aa9 commit c5c8438
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/autoencoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ export class AutoencoderGPU<DecodedData extends INeuralNetworkData, EncodedData
// Create default options for the autoencoder.
options ??= {};

// Inherit the binary threshold of the parent autoencoder.
options.binaryThresh = options.binaryThresh;
// Inherit the hidden layers of the parent autoencoder.
options.hiddenLayers = options.hiddenLayers;

const decodedSize = options.inputSize ?? options.outputSize ?? 1;

// Define the denoiser subnet's input and output sizes.
if (decodedSize) options.inputSize = options.outputSize = decodedSize;
options.inputSize = options.outputSize = decodedSize;

options.hiddenLayers ??= [ Math.round(decodedSize * 0.66) ];

options.loss ??= loss;

Expand Down
8 changes: 7 additions & 1 deletion src/errors/untrained-neural-network-error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { NeuralNetwork } from "../neural-network";

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 16.x and ubuntu-latest

'NeuralNetwork' is defined but never used

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 16.x and windows-latest

'NeuralNetwork' is defined but never used

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

'NeuralNetwork' is defined but never used

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and windows-latest

'NeuralNetwork' is defined but never used

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

'NeuralNetwork' is defined but never used

Check warning on line 1 in src/errors/untrained-neural-network-error.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and windows-latest

'NeuralNetwork' is defined but never used

interface IErrorableNeuralNetwork {
constructor: Function;
}

export class UntrainedNeuralNetworkError extends Error {
constructor (
neuralNetwork: object
neuralNetwork: IErrorableNeuralNetwork
) {
super(`Cannot run a ${neuralNetwork.constructor.name} before it is trained.`);
}
Expand Down

0 comments on commit c5c8438

Please sign in to comment.