Во-первых, вам не нужно использовать итератор. Модель Keras примет объект набора данных вместо отдельных параметров данных / меток и будет обрабатывать итерации. Вам нужно только указать steps_per_epoch
, поэтому вам нужно знать размер набора данных. Если у вас есть отдельный файл tfrecords для обучения / проверки, тогда вы можете просто создать объект набора данных и передать его в validation_data
. Если у вас есть один файл, и вы хотите разбить его, вы можете сделать
dataset = tf.data.TFRecordDataset('file.tfrecords')
dataset_train = dataset.take(size)
dataset_val = dataset.skip(size)
...
The
is evaluated when the script loads and before the
has been processed.
There appears to be more than one way to do this correctly -
Include the
inside of the
and it should be evaluated at the correct time. This will work with MS-Build v3.5+
Use
to generate the item list
Example build script for this -
<!-- Using ItemGroup -->
<Target Name="AfterBuild">
<ItemGroup>
<DeleteAfterBuild Include="$(OutputPath)data\errors\*.xml" />
</ItemGroup>
<Delete Files="@(DeleteAfterBuild)" />
</Target>
<!-- Using CreateItem -->
<Target Name="AfterBuild">
<CreateItem Include="$(OutputPath)data\errors\*.xml">
<Output TaskParameter="Include" ItemName="DeleteAfterBuild"/>
</CreateItem>
<Delete Files="@(DeleteAfterBuild)" />
</Target>
To explain why the delete process was generating 'unpredictable' results -
@(DeleteAfterBuild)
will evaluate with no files as the files don't exist in the $(OutputPath)
folder and will not delete any files as part of the AfterBuild
target@(DeleteAfterBuild)
will evaluate with all the expected files in the $(OutputPath)
folder and will remove the files as part of the AfterBuild
targetReference material: Как: создавать группы элементов на лету , Отсроченная оценка элементов в файле MSBUILD
Посмотрите только что опубликованную мной запись в блоге MSBuild: Item & Property Evaluation , я думаю, это может вам помочь. Дайте мне знать, если нет.
Саид Ибрагим Хашими
Я понимаю, что на это уже был дан ответ, но подумал, что добавлю свои 5 центов. Для проекта веб-развертывания нет необходимости использовать предоставленные цели, просто добавьте группу элементов, содержащую элементы ExcludeFromBuild . Для справки я предоставил соответствующий раздел в нижней части файла проекта развертывания.
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.WebDeployment.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="BeforeMerge">
</Target>
<Target Name="AfterMerge">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\obj\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Properties\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.csproj*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.resx" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.Publish.xml" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\LocalTestRun.testrunconfig" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\TestResults\**\*.*" />
</ItemGroup>