export function getDimensionalityOfActivations()

in neuron_viewer/src/types.ts [20:39]


export function getDimensionalityOfActivations(nodeType: NodeType) {
  switch (nodeType) {
    case NodeType.MLP_NEURON:
    case NodeType.AUTOENCODER_LATENT:
    case NodeType.MLP_AUTOENCODER_LATENT:
    case NodeType.ATTENTION_AUTOENCODER_LATENT:
    case NodeType.RESIDUAL_STREAM_CHANNEL:
    case NodeType.QK_CHANNEL:
    case NodeType.V_CHANNEL:
      return DimensionalityOfActivations.SCALAR_PER_TOKEN;
    case NodeType.AUTOENCODER_LATENT_BY_TOKEN_PAIR:
    case NodeType.ATTENTION_HEAD:
      return DimensionalityOfActivations.SCALAR_PER_TOKEN_PAIR;
    case NodeType.LAYER:
    case NodeType.VOCAB_TOKEN:
      throw new Error(`getDimensionalityOfActivations should not be called on ${nodeType}`);
    default:
      return assertUnreachable(nodeType);
  }
}