VegasGridOptimizer

class VegasGridOptimizer

Refines a VegasMapping grid from accumulated bin statistics.

The training-time counterpart of VegasHistogram — add_data feeds in the per-bin weight sums accumulated during a warm-up run, and optimize rewrites the grid_name global on every context in contexts with the refined grid.

Public Functions

inline VegasGridOptimizer(const std::vector<ContextPtr> &contexts, const std::string &grid_name, double damping)
Parameters:
  • contexts – Contexts sharing the grid to refine.

  • grid_name – Global name of the VEGAS grid.

  • damping – Damping factor limiting the size of a single update.

void add_data(Tensor weights, Tensor inputs)

Accumulate one batch of per-bin weights and inputs; see VegasHistogram.

void optimize()

Refine the grid from the accumulated data and write it back to every context.

std::size_t input_dim() const

Number of grid dimensions.