{
  "id": 220192,
  "title": "Is there a way to generate different random number after each epoch?",
  "url": "/competitions/hubmap-kidney-segmentation/discussion/220192",
  "author_name": "Shihao Shao",
  "post_date": "2021-02-17T16:36:16.203000",
  "votes": 2,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Using tensorflow+keras.<br>\n Due to memory issue, I want to create a layer as an image augmentor, instead of apply the augmentations to the dataset. However, I need generate random number every epoch and which need to be different from each other. I tried adding tf.random to the model generation function, but it seems that the 'random number' will be fixed once the model being compiled, and will not update in every epoch. Does anyone know some way to handle this? Thank you!<br>\n Also, Does anyone tried to build GAN for this competition? It can't be without <code>train_on_batch</code>, however, which gave me error when training with TPU. The error was like 'Prefetch object doesn't have attr shape'. Do you have some ideas?</p>",
  "messages": [
    {
      "id": 1206977,
      "postDate": "2021-02-17T16:36:16.203Z",
      "content": "<p>Using tensorflow+keras.<br>\n Due to memory issue, I want to create a layer as an image augmentor, instead of apply the augmentations to the dataset. However, I need generate random number every epoch and which need to be different from each other. I tried adding tf.random to the model generation function, but it seems that the 'random number' will be fixed once the model being compiled, and will not update in every epoch. Does anyone know some way to handle this? Thank you!<br>\n Also, Does anyone tried to build GAN for this competition? It can't be without <code>train_on_batch</code>, however, which gave me error when training with TPU. The error was like 'Prefetch object doesn't have attr shape'. Do you have some ideas?</p>",
      "rawMarkdown": "  Using tensorflow+keras.\n\n  Due to memory issue, I want to create a layer as an image augmentor, instead of apply the augmentations to the dataset. However, I need generate random number every epoch and which need to be different from each other. I tried adding tf.random to the model generation function, but it seems that the 'random number' will be fixed once the model being compiled, and will not update in every epoch. Does anyone know some way to handle this? Thank you!\n\n  Also, Does anyone tried to build GAN for this competition? It can't be without `train_on_batch`, however, which gave me error when training with TPU. The error was like 'Prefetch object doesn't have attr shape'. Do you have some ideas?",
      "votes": 2
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "1206977": "  Using tensorflow+keras.\n\n  Due to memory issue, I want to create a layer as an image augmentor, instead of apply the augmentations to the dataset. However, I need generate random number every epoch and which need to be different from each other. I tried adding tf.random to the model generation function, but it seems that the 'random number' will be fixed once the model being compiled, and will not update in every epoch. Does anyone know some way to handle this? Thank you!\n\n  Also, Does anyone tried to build GAN for this competition? It can't be without `train_on_batch`, however, which gave me error when training with TPU. The error was like 'Prefetch object doesn't have attr shape'. Do you have some ideas?"
  }
}