fdtdx.ClosestIndex
Bases: ParameterTransformation
Maps continuous latent values to nearest allowed material indices.
For each input value, finds the index of the closest allowed inverse permittivity value. Uses straight-through gradient estimation to maintain differentiability. If mapping_from_inverse_permittivities is set to False (default), then the transform only quantizes the latent parameters to the closest integer value.