MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_minibatch

Function get_minibatch

diffusers/examples/controlnet/train_controlnet_flax.py:938–942  ·  view source on GitHub ↗
(batch, grad_idx)

Source from the content-addressed store, hash-verified

936
937 # get a minibatch (one gradient accumulation slice)
938 def get_minibatch(batch, grad_idx):
939 return jax.tree_util.tree_map(
940 lambda x: jax.lax.dynamic_index_in_dim(x, grad_idx, keepdims=False),
941 batch,
942 )
943
944 def loss_and_grad(grad_idx, train_rng):
945 # create minibatch for the grad step

Callers 1

loss_and_gradFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected