tutorials.examples.train_chip_design_medium

Train a GFlowNet on a medium-sized chip placement problem.

Uses ~15 hard macros on an 8x8 grid (64 cells) with a replay buffer for off-policy training. Logs wirelength and density costs per iteration.

Attributes

parser

Classes

ChipDesignPreprocessor

Base class for state preprocessors.

Functions

main(args)

Module Contents

class tutorials.examples.train_chip_design_medium.ChipDesignPreprocessor(env, embedding_dim=64)

Bases: gfn.preprocessors.Preprocessor

Base class for state preprocessors.

Preprocessors transform raw state tensors into formats suitable for neural network inputs. They handle the conversion from environment-specific state representations to standardized tensor formats that can be processed by neural networks.

Parameters:
output_dim

The dimensionality of the preprocessed output tensor, which is compatible with the neural network that will be used. If None, the output dimension will not be checked.

embedding
embedding_dim = 64
n_macros
preprocess(states)

Transforms the states to the input format for neural networks.

Parameters:

states (gfn.gym.chip_design.ChipDesignStates) – The states to preprocess.

Returns:

A tensor of shape (*batch_shape, output_dim) containing the preprocessed states.

Return type:

torch.Tensor

tutorials.examples.train_chip_design_medium.main(args)
tutorials.examples.train_chip_design_medium.parser