export function gtensorOfDims()

in rfcs/20210731-tfjs-named-tensors/gtensor.ts [236:245]


export function gtensorOfDims<G extends DName>(dims: Dims<G>): GTensor<G> {
  // Technically, we don't know the dimension is G... but it doesn't matter, this makes TS happy.
  // In theory I think `unknown` should replace the second G.
  const d = Object.values(dims)[0] as Dimension<G, G>;
  if (!d) {
    throw new ValueError('gtensorOfDims: empty set of dimensions');
  }

  return d.gtensor;
}