Neural models¶
Flax NNX modules. The generative families share one interface — construct with
nnx.Rngs, fit to train, as_dist() for a frozen distribution — so they are
interchangeable. See Density estimation.
This page covers the user-facing surface. probjax.nn also exports the building
blocks those models are assembled from (attention masks, block sizes, individual
bijector configs); read the source for those.
Normalizing flows¶
probjax.nn.NormalizingFlow
¶
Bases: StandardizingMixin, GenerativeModel
Source code in probjax/nn/generative/nflows/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
transform
¶
Push a base sample through to the data space.
Data space, not standardised space: this has to agree with sample
and logpdf. self.transformation is the inner map and stays in
standardised coordinates, which is what _logpdf feeds it.
Source code in probjax/nn/generative/nflows/models.py
fit
¶
Fit the standardising transform once, then train as usual.
Source code in probjax/nn/generative/nflows/models.py
loss
¶
Negative mean log-likelihood training loss.
With context, each data row is scored against its own context row
(per-pair conditional likelihood).
Source code in probjax/nn/generative/nflows/models.py
as_dist
¶
Create a lazy compiled sampling and log-density view of this flow.
Source code in probjax/nn/generative/nflows/models.py
probjax.nn.NFlowConfig
dataclass
¶
Shape of a normalizing flow plus its three configuration axes.
Source code in probjax/nn/generative/nflows/config.py
Autoregressive models¶
probjax.nn.MADE
¶
Bases: Autoregressive
Gaussian conditionals over a masked MLP (Germain et al., 2015).
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.MixtureAutoregressive
¶
Bases: Autoregressive
Mixture-density conditionals: the KDE-like flexible head.
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.SplineAutoregressive
¶
Bases: Autoregressive
Spline-warped normal conditionals.
Distinct from SplineAutoregressiveFlow: that composes spline bijections,
this predicts a spline-warped distribution per dimension.
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.HistogramAutoregressive
¶
Bases: Autoregressive
Piecewise-constant conditionals with exponential tails.
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.CategoricalAutoregressive
¶
Bases: Autoregressive
Categorical conditionals over integer-valued data.
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.Autoregressive
¶
Bases: StandardizingMixin, GenerativeModel
Autoregressive density over input_dim variables.
Parameters¶
input_dim :
Number of variables in the joint.
family :
The univariate conditional, as an :class:ARFamily. A bare
probjax.stats generator is accepted and wrapped.
conditioner :
Config for the masked network. Defaults to a MADE-style masked MLP.
context_features :
Width of an optional conditioning vector.
Source code in probjax/nn/generative/autoregressive/model.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
predict_params
¶
Per-dimension parameter blocks, shape (..., input_dim, params_dim).
Source code in probjax/nn/generative/autoregressive/model.py
conditional_logpdfs
¶
log p(x_i | x_<i) for every i, shape (..., input_dim).
Source code in probjax/nn/generative/autoregressive/model.py
loss
¶
Negative mean joint log-likelihood.
Source code in probjax/nn/generative/autoregressive/model.py
sample
¶
Ancestral sampling: one conditioner pass per dimension.
The naive loop scans over the event dimension, which is static, so it survives export with a symbolic batch size.
prefix conditions the draw on known leading values: with
prefix of shape (..., input_dim) and prefix_len=k the
first k positions are clamped to prefix and only the rest
are sampled -- image completion from a top half, for example.
prefix_len may be any value in [0, input_dim].
With a transformer conditioner, use_cache=True (the default)
decodes with the attention KV cache instead of re-reading the whole
prefix at every step; False selects the naive loop, which is
also what non-transformer conditioners always use. Both paths draw
from the same per-dimension keys, so they agree up to the
floating-point dust between the two compiled scans.
The cached loop is compiled to a single program and does
asymptotically less attention work (one growing prefix row per step
instead of a full matrix). Time both paths with
block_until_ready -- JAX dispatches asynchronously, so bare
time.time differences only measure enqueueing.
Source code in probjax/nn/generative/autoregressive/model.py
fit
¶
Fit the standardising transform once, then train as usual.
Source code in probjax/nn/generative/autoregressive/model.py
probjax.nn.ARFamily
dataclass
¶
A univariate probjax.stats family used as a conditional head.
Parameters¶
dist :
The distribution generator, e.g. norm, laplace, histogram.
hyper :
Hyperparameters fixing the parameter vector lengths, forwarded to
dist.param_sizes (e.g. num_components, num_bins).
fixed :
Parameters that are not predicted, supplied as constants instead.
Integer-constrained parameters must go here.
constrain :
Per-parameter overrides of the default constrainer.
discrete :
Whether the data are integer-valued; drives the event dtype and the
one-hot encoding of the conditioner's input.
Source code in probjax/nn/generative/autoregressive/config.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
raw_sizes
¶
Unconstrained block length the conditioner must emit per parameter.
Source code in probjax/nn/generative/autoregressive/config.py
params_dim
¶
unpack
¶
Split a (..., params_dim) vector into constrained parameters.
Source code in probjax/nn/generative/autoregressive/config.py
params_init
¶
rvs
¶
One draw per batch element, using the family's own sampler.
encode
¶
Conditioner input encoding.
Integer labels carry no usable metric, so a discrete family one-hots them; continuous data passes through.
Source code in probjax/nn/generative/autoregressive/config.py
bounded_support
¶
(low, high) when the family's support is a bounded interval.
Used to reject out-of-range training data loudly instead of silently
returning -inf.
Source code in probjax/nn/generative/autoregressive/config.py
mixture
classmethod
¶
Mixture head, with the component locations pulled apart at init.
The offset is not cosmetic. A zero-initialised conditioner emits the same vector for every component, so all of them share a location, a scale and a gradient -- the mixture is exactly one kernel and stays that way, since nothing breaks the symmetry. Spreading the locations deterministically makes each component see a different gradient from the first step, at no cost to the neutral density being sensible.
Source code in probjax/nn/generative/autoregressive/config.py
histogram
classmethod
¶
Piecewise-constant head; tails keeps the support unbounded.
Source code in probjax/nn/generative/autoregressive/config.py
spline
classmethod
¶
Spline-warped normal head; knots span the given ranges exactly.
latent_bound defaults to bound so that zero parameters give
matching knots with unit slopes -- an identity spline, i.e. exactly a
standard normal.
Source code in probjax/nn/generative/autoregressive/config.py
Diffusion and flow matching¶
probjax.nn.EDM
¶
Bases: DiffusionDenoiser
EDM-style model
- EDMNoiseSchedule
- EDMPreconditioning
- EDMTrainingConfig (t == sigma)
- EDMSolverConfig by default
Source code in probjax/nn/generative/diffusion/model.py
probjax.nn.VP
¶
Bases: DiffusionDenoiser
VP variant
- VPNoiseSchedule(beta_min, beta_max)
- EDMPreconditioning (σ_eff-based)
- SigmaEffEDMTrainingConfig (log-normal in σ_eff)
- BaseSolverConfig by default
Source code in probjax/nn/generative/diffusion/model.py
probjax.nn.VE
¶
Bases: DiffusionDenoiser
VE variant
- VENoiseSchedule(sigma_min, sigma_max)
- EDMPreconditioning
- UniformTTrainingConfig
- BaseSolverConfig by default
Source code in probjax/nn/generative/diffusion/model.py
probjax.nn.MultinomialDiffusion
¶
Bases: GenerativeModel
Discrete diffusion model with denoising_diffusion_model-like composition
- schedule
- preconditioning
- training config
Source code in probjax/nn/generative/discrete/model.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
score_reparameterized
¶
Relaxed discrete score: gradient wrt relaxed x_t simplex variable.
Uses Gumbel-Softmax reparameterization and computes
grad_{x_t_relaxed} E[
Source code in probjax/nn/generative/discrete/model.py
probjax.nn.DiffusionDenoiser
¶
Bases: GenerativeModel
Composable diffusion denoiser:
- schedule : NoiseScheduleProtocol (physical schedule)
- precond : PreconditioningProtocol (defines c_in/out/etc)
- train_cfg : TrainingConfigProtocol (defines t sampling)
- solver_cfg : SolverConfigProtocol (defines solve ODE/SDE)
Source code in probjax/nn/generative/diffusion/model.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
v
¶
Normalized v
v = alpha_hat(t) * eps - sigma_hat(t) * x0
based on normalized (alpha_hat, sigma_hat).
Source code in probjax/nn/generative/diffusion/model.py
probjax.nn.FlowMatcher
¶
Bases: GenerativeModel
Composable flow matcher:
- schedule : InterpolationScheduleProtocol
- precond : FlowPreconditioningProtocol
- train_cfg : FlowTrainingConfigProtocol
- solver_cfg : FlowSolverConfigProtocol | None
Source code in probjax/nn/generative/flow_matching/model.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
probjax.nn.MeanFlowMatcher
¶
Bases: GenerativeModel
Source code in probjax/nn/generative/mean_flow/model.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
loss
¶
Mean flow matching loss (Improved MeanFlow v-loss by default).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
imf
|
bool | None
|
Use the Improved MeanFlow objective. Defaults to
|
None
|
Source code in probjax/nn/generative/mean_flow/model.py
probjax.nn.LinearFlow
¶
Bases: FlowMatcher
Source code in probjax/nn/generative/flow_matching/model.py
Architectures¶
probjax.nn.MLP
¶
Bases: Module
Multi-layer perceptron (MLP) module with configurable layers and activation.
Source code in probjax/nn/nets/simple.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
probjax.nn.ResNet
¶
Bases: Module
Residual neural network with optional context conditioning.
Source code in probjax/nn/nets/simple.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
probjax.nn.Transformer
¶
Bases: Module
A transformer stack.
Source code in probjax/nn/nets/transformer.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
probjax.nn.UNet
¶
Bases: Module
Flexible U-Net with pluggable submodules and per-layer drop-path.
Pluggable builders: - ResNet blocks (default: ResnetBlock) - Downsampling convolutions (default: nnx.Conv) - Upsampling convolutions (default: nnx.ConvTranspose) - Spatial attention blocks (default: SpatialSelfAttention)
Required constructor signatures for swappable modules: - resnet_block_cls: Callable[..., nnx.Module] init(in_features: int, out_features: int, *, kernel_size, strides, context_features=None, dropout_rate=0.0, drop_path_rate=0.0, rngs: nnx.Rngs, ...) call(x, context=None, *, deterministic: bool = True) -> Array
-
conv_down_cls / conv_up_cls: Callable[..., nnx.Module] init(in_features: int, out_features: int, *, kernel_size, strides, rngs: nnx.Rngs, ...) call(x) -> Array
-
attn_cls: Callable[..., nnx.Module] init(features: int, *, dropout_rate=0.0, rngs: nnx.Rngs, ...) call(x, context=None, *, deterministic: bool = True) -> Array
-
conv_cls (1x1 projections): Callable[..., nnx.Module] init(in_features: int, out_features: int, *, kernel_size=1, use_bias: bool, rngs: nnx.Rngs, ...) must accept
kernel_initas kwarg for final layer init.
All builders should accept standard precision/dtype kwargs as applicable:
dtype, precision, param_dtype, preferred_element_type (some may be
filtered by filter_precision_kwargs).
Drop-path configuration: - drop_path_rate: float applied uniformly to all ResNet blocks, or a sequence of length (2 * num_stages + 2). Layer indices are: [0..num_stages-1] Down path ResNet blocks [num_stages] Middle block 1 [num_stages+1] Middle block 2 [num_stages+2 .. end] Up path ResNet blocks (from bottom to top) If a sequence is provided, it overrides the uniform rate.
Source code in probjax/nn/nets/unets.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
probjax.nn.DeepSet
¶
Bases: Module
Deep Sets module for permutation-invariant functions.
Implements the Deep Sets architecture that processes sets of elements in a permutation-invariant manner using the formula: f(X) = ρ(Σ φ(x_i)) where X = {x_1, ..., x_n}
Source code in probjax/nn/nets/simple.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | |