in rfcs/20210731-tfjs-named-tensors/gtensor.ts [301:312]
_resetDim() {
this.dim = {} as Dims<G>;
for (let i = 0; i < this.dimNames.length; i++) {
const dim_i = new Dimension({
name: this.dimNames[i],
index: i,
size: this.tensor.shape[i],
gtensor: this,
});
(this.dim as {[k:string]: Dimension<G, any>})[dim_i.name as string] = dim_i;
}
}