get structured data
(self, dtype)
| 345 | return lnx, decoder_segment_ids, decoder_positions |
| 346 | |
| 347 | def get_structured_data(self, dtype): |
| 348 | """get structured data""" |
| 349 | lnx = jax.random.normal( |
| 350 | self.rng, |
| 351 | shape=(self.global_batch_size, self.max_target_length, self.embed_dim), |
| 352 | dtype=dtype, |
| 353 | ) |
| 354 | |
| 355 | decoder_positions = jnp.stack( |
| 356 | [jnp.arange(self.max_target_length, dtype=jnp.int32) for _ in range(self.global_batch_size)] |
| 357 | ) |
| 358 | |
| 359 | decoder_segment_ids = ( |
| 360 | jax.numpy.zeros((self.global_batch_size, self.max_target_length)) + DECODING_ACTIVE_SEQUENCE_INDICATOR |
| 361 | ) |
| 362 | |
| 363 | return lnx, decoder_segment_ids, decoder_positions |
| 364 | |
| 365 | @pytest.mark.tpu_only |
| 366 | def test_autoregression(self): |
no outgoing calls
no test coverage detected