Tidy3DAutogradConfig
Tidy3DAutogradConfig(**data: 'Any') -> 'None'Configuration for Tidy3D-specific autograd finite-difference behavior.
Args
- gradient_method: Literal[‘geometry’, ‘permittivity’, ‘auto’] = auto
- exclude_domain_spanning_structures: bool = True
- relative_diff_step: Union[float, dict[str, float]] = 0.01
- absolute_diff_step: Union[float, dict[str, float]] = 1e-06
- diff_step_growth_factor: float = 2.0
- max_diff_attempts: int = 8
- min_jacobian_norm: float = 1e-12
- consistency_similarity_threshold: float = 0.9
- consistency_magnitude_tolerance: float = 0.2
gradient_method="auto" prefers geometry Jacobian routing for each
(parameter, structure) pair when that Jacobian entry has signal, and falls
back to permittivity routing otherwise. If geometry finite differences
report an issue for one parameter row, auto mode falls back to permittivity
for that whole parameter row.
gradient_method="geometry" maps Tidy3D geometry derivatives through
finite-difference geometry Jacobians. "permittivity" maps medium
permittivity derivatives through finite-difference epsilon sensitivities.
Methods
Section titled “Methods”| Method | Description |
|---|---|
absolute_diff_step_for | Return absolute finite-difference step for one flattened parameter. |
model_post_init | This function is meant to behave like a BaseModel method to initialize private attributes. |
relative_diff_step_for | Return relative finite-difference step for one flattened parameter. |
validate_step_keys | Reject typo keys that do not match traced parameter names. |
absolute_diff_step_for
Section titled “absolute_diff_step_for”absolute_diff_step_for(self, param_name: 'str') -> 'float'Return absolute finite-difference step for one flattened parameter.
model_post_init
Section titled “model_post_init”model_post_init(self: 'BaseModel', context: 'Any', /) -> 'None'This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
Args
- self: The BaseModel instance.
- context: The context.
relative_diff_step_for
Section titled “relative_diff_step_for”relative_diff_step_for(self, param_name: 'str') -> 'float'Return relative finite-difference step for one flattened parameter.
validate_step_keys
Section titled “validate_step_keys”validate_step_keys(self, param_names: 'Sequence[str]') -> 'None'Reject typo keys that do not match traced parameter names.
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
DEFAULT_ABSOLUTE_DIFF_STEP | Convert a string or number to a floating-point number, if possible. |
DEFAULT_RELATIVE_DIFF_STEP | Convert a string or number to a floating-point number, if possible. |
model_config | dict() -> new empty dictionary |
DEFAULT_ABSOLUTE_DIFF_STEP
Section titled “DEFAULT_ABSOLUTE_DIFF_STEP”Convert a string or number to a floating-point number, if possible.
DEFAULT_RELATIVE_DIFF_STEP
Section titled “DEFAULT_RELATIVE_DIFF_STEP”Convert a string or number to a floating-point number, if possible.
model_config
Section titled “model_config”dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)