Addressing ImageReader CR from Frank
This commit is contained in:
Родитель
27fd4e045b
Коммит
f5a349a11a
|
@ -21,12 +21,12 @@
|
|||
<Choose>
|
||||
<When Condition="'$(Configuration)|$(Platform)'=='Debug_CpuOnly|x64' Or '$(Configuration)|$(Platform)'=='Release_CpuOnly|x64'">
|
||||
<PropertyGroup>
|
||||
<UsesCuda>false</UsesCuda>
|
||||
<UsesCuda>false</UsesCuda>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<UsesCuda>true</UsesCuda>
|
||||
<UsesCuda>true</UsesCuda>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
@ -116,9 +116,9 @@
|
|||
<ClCompile>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions);CPUONLY</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<DelayLoadDLLs>Math.dll; msmpi.dll;</DelayLoadDLLs>
|
||||
</Link>
|
||||
<Link>
|
||||
<DelayLoadDLLs>Math.dll; msmpi.dll;</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' Or '$(Configuration)|$(Platform)'=='Release_CpuOnly|x64'">
|
||||
<ClCompile>
|
||||
|
@ -188,6 +188,7 @@
|
|||
<ClInclude Include="..\Common\Include\Basics.h" />
|
||||
<ClInclude Include="..\Common\Include\BestGpu.h" />
|
||||
<ClInclude Include="..\Common\Include\DataReader.h" />
|
||||
<ClInclude Include="..\Common\Include\StringUtil.h" />
|
||||
<ClInclude Include="..\Common\Include\TensorShape.h" />
|
||||
<ClInclude Include="..\Common\Include\DataWriter.h" />
|
||||
<ClInclude Include="..\Common\Include\File.h" />
|
||||
|
@ -242,7 +243,8 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64' Or '$(Configuration)|$(Platform)'=='Debug_CpuOnly|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\DebugUtil.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64' Or '$(Configuration)|$(Platform)'=='Debug_CpuOnly|x64'"></PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64' Or '$(Configuration)|$(Platform)'=='Debug_CpuOnly|x64'">
|
||||
</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Common\Include\ConcStack.h" />
|
||||
<ClCompile Include="..\Common\TimerUtility.cpp" />
|
||||
|
@ -265,4 +267,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -193,6 +193,9 @@
|
|||
<ClInclude Include="..\ComputationNetworkLib\TrainingNodes.h">
|
||||
<Filter>from ComputationNetworkLib\Nodes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Common\Include\StringUtil.h">
|
||||
<Filter>Common\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="modelEditor.txt">
|
||||
|
@ -263,4 +266,4 @@
|
|||
<Filter>BrainScript\Doc</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -6,17 +6,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <locale>
|
||||
|
||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||
|
||||
// Compares two ASCII strings ignoring the case.
|
||||
// TODO: Should be moved to common CNTK library and after switching to boost, boost::iequal should be used instead.
|
||||
// TODO: Should switch to boost, boost::iequal should be used instead.
|
||||
inline bool AreEqualIgnoreCase(const std::string& s1, const std::string& s2)
|
||||
{
|
||||
return std::equal(s1.begin(), s1.end(), s2.begin(), [](const char& a, const char& b)
|
||||
{
|
||||
return std::tolower(a) == std::tolower(b);
|
||||
});
|
||||
{
|
||||
return std::tolower(a) == std::tolower(b);
|
||||
});
|
||||
}
|
||||
|
||||
} } }
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "ImageConfigHelper.h"
|
||||
#include "StringUtils.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||
|
||||
|
@ -49,11 +49,11 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
size_t c = featureSection("channels");
|
||||
|
||||
std::string mbFmt = featureSection("mbFormat", "nchw");
|
||||
if (AreEqualIgnoreCase(mbFmt, "nhwc"))
|
||||
if (AreEqualIgnoreCase(mbFmt, "nhwc") || AreEqualIgnoreCase(mbFmt, "legacy"))
|
||||
{
|
||||
m_dataFormat = HWC;
|
||||
}
|
||||
else if (!AreEqualIgnoreCase(mbFmt, "nchw"))
|
||||
else if (!AreEqualIgnoreCase(mbFmt, "nchw") || AreEqualIgnoreCase(mbFmt, "cudnn"))
|
||||
{
|
||||
RuntimeError("ImageReader does not support the sample format '%s', only 'nchw' and 'nhwc' are supported.", mbFmt.c_str());
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ void ImageReader::StartEpoch(const EpochConfiguration& config)
|
|||
{
|
||||
if (config.m_totalEpochSizeInSamples <= 0)
|
||||
{
|
||||
RuntimeError("Unsupported minibatch size '%d'.",
|
||||
static_cast<int>(config.m_totalEpochSizeInSamples));
|
||||
RuntimeError("Unsupported minibatch size '%u'.", (int)config.m_totalEpochSizeInSamples);
|
||||
}
|
||||
|
||||
m_transformer->StartEpoch(config);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "Config.h"
|
||||
#include "ConcStack.h"
|
||||
#include "ImageConfigHelper.h"
|
||||
#include "StringUtils.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ElementTypeUtils.h"
|
||||
|
||||
namespace Microsoft { namespace MSR { namespace CNTK
|
||||
|
|
|
@ -18,8 +18,8 @@ struct SequenceDescription
|
|||
size_t m_id; // Sequence id, uniquely identifies the sequence.
|
||||
size_t m_numberOfSamples; // Number of samples in a sequence.
|
||||
size_t m_chunkId; // Each sequence belongs to an I/O chunk, how chunk is defined is specific to a
|
||||
// particular data deserializer. The randomizer guarantees to request sequences
|
||||
// from only limited subset of chunks at any moment in time.
|
||||
// particular data deserializer (or bundler). The randomizer guarantees to request
|
||||
// sequences from only limited subset of chunks at any moment in time.
|
||||
bool m_isValid; // Indicates whether the sequence is valid.
|
||||
};
|
||||
typedef std::vector<const SequenceDescription*> SequenceDescriptions;
|
||||
|
@ -73,6 +73,7 @@ class DataDeserializer
|
|||
{
|
||||
public:
|
||||
// Describes streams this data deserializer can produce. Streams correspond to network inputs.
|
||||
// TODO: Introduce the interface to reduce the size of the sequences available at any point in time (chunks/sequences).
|
||||
virtual std::vector<StreamDescriptionPtr> GetStreamDescriptions() const = 0;
|
||||
|
||||
// Retrieves description of all sequences this data deserializer can produce.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
namespace Microsoft { namespace MSR { namespace CNTK {
|
||||
|
||||
// The class represents a randomizer that does not randomize input (identity function over the original timeline).
|
||||
// This class is used for inference and for training where the training data has already been pre - randomized.
|
||||
// TODO: currently this code moved from the old block randomizer.
|
||||
// The class will be further refactored and common based will be extracted with BlockRandomizer.
|
||||
// Currently works only for frame mode (numberOfSample in sequence == 1) and without chunking
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
<ClInclude Include="MemoryProvider.h" />
|
||||
<ClInclude Include="Reader.h" />
|
||||
<ClInclude Include="ReaderShim.h" />
|
||||
<ClInclude Include="StringUtils.h" />
|
||||
<ClInclude Include="Transformer.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -98,4 +97,4 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -31,9 +31,6 @@
|
|||
<ClInclude Include="ElementTypeUtils.h">
|
||||
<Filter>Utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StringUtils.h">
|
||||
<Filter>Utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TransformerBase.h">
|
||||
<Filter>Transformers</Filter>
|
||||
</ClInclude>
|
||||
|
@ -81,4 +78,4 @@
|
|||
<UniqueIdentifier>{90d4b51b-73ae-47f5-9a9e-97ef287dcead}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -15,12 +15,11 @@ SampleModePacker::SampleModePacker(
|
|||
MemoryProviderPtr memoryProvider,
|
||||
TransformerPtr transformer,
|
||||
size_t minibatchSize,
|
||||
const std::vector<StreamDescriptionPtr>& streams)
|
||||
: m_transformer(transformer),
|
||||
m_minibatchSize(minibatchSize),
|
||||
m_outputStreams(streams),
|
||||
m_minibatchLayout(std::make_shared<MBLayout>()),
|
||||
m_memoryProvider(memoryProvider)
|
||||
const std::vector<StreamDescriptionPtr>& streams) : m_transformer(transformer),
|
||||
m_minibatchSize(minibatchSize),
|
||||
m_outputStreams(streams),
|
||||
m_minibatchLayout(std::make_shared<MBLayout>()),
|
||||
m_memoryProvider(memoryProvider)
|
||||
{
|
||||
m_inputStreams = m_transformer->GetStreamDescriptions();
|
||||
assert(m_inputStreams.size() == m_outputStreams.size());
|
||||
|
|
Загрузка…
Ссылка в новой задаче