{
  "scope": "Hand-set CPU mechanics only; no corpus, optimizer, trained task, accuracy or benchmark.",
  "environment": {
    "python": "3.10.12",
    "torch": "2.3.1+cu118",
    "device": "cpu",
    "dtype": "torch.float64"
  },
  "parameters_pytorch_orientation": {
    "W_ih": [
      [
        0.4,
        -0.2
      ],
      [
        0.1,
        0.3
      ]
    ],
    "W_hh": [
      [
        0.5,
        0.15
      ],
      [
        -0.25,
        0.4
      ]
    ],
    "b_ih": [
      0.05,
      -0.1
    ],
    "b_hh": [
      -0.02,
      0.03
    ]
  },
  "inputs": {
    "token_names": [
      "A",
      "B",
      "C"
    ],
    "values": [
      [
        1.0,
        0.0
      ],
      [
        0.0,
        1.0
      ],
      [
        1.0,
        1.0
      ]
    ],
    "initial_hidden": [
      0.1,
      -0.2
    ]
  },
  "shapes": {
    "input_batch_first": [
      1,
      3,
      2
    ],
    "initial_hidden": [
      1,
      1,
      2
    ],
    "output_all_hidden": [
      1,
      3,
      2
    ],
    "final_hidden": [
      1,
      1,
      2
    ]
  },
  "forward": {
    "preactivations_python": [
      [
        0.45,
        -0.07500000000000001
      ],
      [
        0.029720549021879056,
        0.09458137241249837
      ],
      [
        0.2590009528070795,
        0.36029218878742264
      ]
    ],
    "hidden_python": [
      [
        0.4218990052500079,
        -0.07485969068749912
      ],
      [
        0.029711801283024964,
        0.09430034777044712
      ],
      [
        0.25336085288950694,
        0.3454713760228567
      ]
    ],
    "hidden_torch": [
      [
        0.42189900525000795,
        -0.0748596906874991
      ],
      [
        0.029711801283025002,
        0.0943003477704471
      ],
      [
        0.253360852889507,
        0.34547137602285677
      ]
    ],
    "max_abs_error": 5.551115123125783e-17
  },
  "order": {
    "permutation": [
      2,
      0,
      1
    ],
    "token_names": [
      "C",
      "A",
      "B"
    ],
    "reordered_final_hidden": [
      0.10161129741868516,
      0.1206075532861949
    ],
    "original_final_hidden": [
      0.253360852889507,
      0.34547137602285677
    ],
    "max_abs_final_difference": 0.2248638227366619,
    "interpretation": "This parameter/input example is order-sensitive; not proof all RNN settings distinguish all permutations."
  },
  "chunks": {
    "split_lengths": [
      2,
      1
    ],
    "carry_max_abs_error": 0.0,
    "reset_to_zero_final_hidden": [
      0.22602835227867096,
      0.3185207769027709
    ],
    "reset_max_abs_final_difference": 0.02733250061083603,
    "interpretation": "Forward state carry matches full sequence. This no_grad example does not test truncated-BPTT gradients."
  },
  "gradient": {
    "objective": "0.5*sum_t,sum_hidden (h_t-target_t)^2, no averaging",
    "artificial_targets": [
      [
        0.2,
        -0.1
      ],
      [
        -0.2,
        0.3
      ],
      [
        0.1,
        0.2
      ]
    ],
    "step_losses": [
      0.024935601841635638,
      0.04753992928802549,
      0.022340736220490195
    ],
    "loss": 0.09481626735015132,
    "autograd_shared_W_hh": [
      [
        0.14985321548960498,
        -0.07064264872971003
      ],
      [
        -0.050502258477009156,
        0.01939312472779483
      ]
    ],
    "analytic_bptt_shared_W_hh": [
      [
        0.14985321548960495,
        -0.07064264872971004
      ],
      [
        -0.05050225847700915,
        0.01939312472779483
      ]
    ],
    "analytic_deltas_time_order": [
      [
        0.3201185172805664,
        0.012750609281630208
      ],
      [
        0.26920479287012994,
        -0.1317464055104972
      ],
      [
        0.14351635568935586,
        0.12810929868279045
      ]
    ],
    "parameter_reuse_contributions_time_order": [
      [
        [
          0.032011851728056644,
          -0.06402370345611329
        ],
        [
          0.001275060928163021,
          -0.002550121856326042
        ]
      ],
      [
        [
          0.11357723432044224,
          -0.020152587525850196
        ],
        [
          -0.05558367743014293,
          0.009862495165705651
        ]
      ],
      [
        [
          0.00426412944110607,
          0.013533642252253444
        ],
        [
          0.0038063580249707617,
          0.012080751418415222
        ]
      ]
    ],
    "per_time_loss_total_gradients": [
      [
        [
          0.018240125511127664,
          -0.03648025102225533
        ],
        [
          0.002499942369061563,
          -0.004999884738123126
        ]
      ],
      [
        [
          0.11045200331531867,
          -0.0444257312226998
        ],
        [
          -0.09069851896653114,
          0.02463323154693968
        ]
      ],
      [
        [
          0.021161086663158662,
          0.01026333351524509
        ],
        [
          0.03769631812046044,
          -0.0002402220810217284
        ]
      ]
    ],
    "partition_warning": "Reuse contributions include downstream losses; per-time-loss gradients include earlier parameter uses. These are distinct decompositions of the same total.",
    "finite_difference_W_hh_0_0": 0.14985321548921515,
    "finite_difference_epsilon": 1e-06,
    "finite_difference_abs_error": 3.898270595215081e-13,
    "all_three_reuse_contributions_0_0_nonzero": true
  },
  "checks": "PASS: Python/nn.RNN forward, all output/h_n shapes, order difference, carry/reset, per-loss sum, analytic BPTT, finite difference."
}
