Skip to main content

Class: NTCGPUModel

Encapsulates the GPU StorageBuffers, uniforms, and CPU synchronizers for neural texture training. weightsBuffers/latentsBuffers shapes intentionally mirror NeuralAppearanceGPUModel's so the Adam / gradient- clip compute kernels can be reused verbatim.

Constructors​

Constructor​

new NTCGPUModel(options?): NTCGPUModel

Parameters​

options?​

NTCGPUModelOptions = {}

Returns​

NTCGPUModel

Properties​

activationsAttribute​

activationsAttribute: any


activationsStorage​

activationsStorage: any


batchSize​

batchSize: number


floatGradients​

floatGradients: boolean


gradNormAtomic​

gradNormAtomic: any


gradNormAttribute​

gradNormAttribute: any


invBatchUniform​

invBatchUniform: any


latentsBuffers​

latentsBuffers: AdamParameterBuffers


layout​

layout: NTCTextureModelLayout


learningRateUniform​

learningRateUniform: any


lossAtomic​

lossAtomic: any


lossAttribute​

lossAttribute: any


maxGradientNormUniform​

maxGradientNormUniform: any


options​

options: NTCGPUModelOptions


quantization​

quantization: ResolvedNTCQuantizationConfig


quantizationNoiseUniform​

quantizationNoiseUniform: any


quantizationRangeUniforms​

quantizationRangeUniforms: object[]

max​

max: any

min​

min: any


stepUniform​

stepUniform: any


weightsBuffers​

weightsBuffers: AdamParameterBuffers


weightsLearningRateScale​

weightsLearningRateScale: number

Methods​

dispose()​

dispose(): void

Releases every GPU storage buffer this instance owns. Training GPU models are cheap to construct but hold 11 real GPU-side buffers - a fresh trainer run that doesn't dispose the previous one leaks them.

Returns​

void


getQuantizationRange()​

getQuantizationRange(): [number, number][]

Reads back the current per-level quantization range as plain [min, max] arrays (not TSL uniform nodes) - used to freeze the final range at the end of training (see NTCTrainer.js).

Returns​

[number, number][]


initFromCPUModel()​

initFromCPUModel(cpuModel): void

Parameters​

cpuModel​

any

Returns​

void


readLoss()​

readLoss(renderer): Promise<number>

Parameters​

renderer​

any

Returns​

Promise<number>


resetLoss()​

resetLoss(): void

Returns​

void


setQuantizationRange()​

setQuantizationRange(ranges): void

Updates every per-level quantization-range uniform from a freshly computed [min, max] tuple array (see NeuralQuantization.computeLatentRanges) - called periodically (and once more at the very end) by NTCTrainer.js when quantization.range === 'auto'.

Parameters​

ranges​

[number, number][]

Returns​

void


syncToCPU()​

syncToCPU(cpuModel, renderer): Promise<void>

Parameters​

cpuModel​

any

renderer​

any

Returns​

Promise<void>