Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
eldakms committed Mar 21, 2016
1 parent e7e1990 commit 26b94ed
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Source/Readers/ExperimentalHTKMLFReader/HTKMLFReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ HTKMLFReader::HTKMLFReader(MemoryProviderPtr provider,
}

int verbosity = readerConfig(L"verbosity", 2);
m_randomizer = std::make_shared<PartialBlockRandomizer>(verbosity, window, bundler, PartialBlockRandomizer::DecimationMode::chunk, true /* useLegacyRandomization */);
m_randomizer = std::make_shared<BlockRandomizer>(verbosity, window, bundler, BlockRandomizer::DecimationMode::chunk, true /* useLegacyRandomization */);
m_randomizer->Initialize(nullptr, readerConfig);

// Create output stream descriptions (all dense)
Expand Down
4 changes: 2 additions & 2 deletions Source/Readers/ExperimentalHTKMLFReader/HTKMLFReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "Reader.h"
#include "SampleModePacker.h"
#include "PartialBlockRandomizer.h"
#include "BlockRandomizer.h"

namespace Microsoft { namespace MSR { namespace CNTK {

Expand Down Expand Up @@ -44,7 +44,7 @@ class HTKMLFReader : public Reader
// Memory provider (TODO: this will possibly change in the near future.)
MemoryProviderPtr m_provider;

std::shared_ptr<PartialBlockRandomizer> m_randomizer;
std::shared_ptr<BlockRandomizer> m_randomizer;
};

}}}
4 changes: 2 additions & 2 deletions Source/Readers/ImageReader/ImageReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Config.h"
#include "ImageConfigHelper.h"
#include "ImageTransformers.h"
#include "PartialBlockRandomizer.h"
#include "BlockRandomizer.h"
#include "NoRandomizer.h"
#include "ImageDataDeserializer.h"
#include <omp.h>
Expand Down Expand Up @@ -39,7 +39,7 @@ ImageReader::ImageReader(MemoryProviderPtr provider,
TransformerPtr randomizer;
if (configHelper.ShouldRandomize())
{
randomizer = std::make_shared<PartialBlockRandomizer>(0, 1, deserializer, PartialBlockRandomizer::DecimationMode::sequence, false);
randomizer = std::make_shared<BlockRandomizer>(0, 1, deserializer, BlockRandomizer::DecimationMode::sequence, false);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define _CRT_SECURE_NO_WARNINGS

#include "PartialBlockRandomizer.h"
#include "BlockRandomizer.h"
#include <algorithm>
#include <utility>
#include <deque>
Expand All @@ -16,7 +16,7 @@

namespace Microsoft { namespace MSR { namespace CNTK {

PartialBlockRandomizer::PartialBlockRandomizer(
BlockRandomizer::BlockRandomizer(
int verbosity,
size_t randomizationRangeInSamples,
IDataDeserializerPtr deserializer,
Expand Down Expand Up @@ -46,7 +46,7 @@ PartialBlockRandomizer::PartialBlockRandomizer(
}

// Start a new epoch.
void PartialBlockRandomizer::StartEpoch(const EpochConfiguration& config)
void BlockRandomizer::StartEpoch(const EpochConfiguration& config)
{
m_config = config;
if (config.m_totalEpochSizeInSamples == requestDataSize)
Expand All @@ -68,7 +68,7 @@ void PartialBlockRandomizer::StartEpoch(const EpochConfiguration& config)
}

// Prepares a new sweep if needed.
void PartialBlockRandomizer::PrepareNewSweepIfNeeded(size_t samplePosition)
void BlockRandomizer::PrepareNewSweepIfNeeded(size_t samplePosition)
{
size_t sweep = samplePosition / m_sweepTotalNumberOfSamples;
if (m_sweep != sweep)
Expand All @@ -89,7 +89,7 @@ void PartialBlockRandomizer::PrepareNewSweepIfNeeded(size_t samplePosition)
}

// Gets next sequences not exceeding sampleCount.
Sequences PartialBlockRandomizer::GetNextSequences(size_t sampleCount)
Sequences BlockRandomizer::GetNextSequences(size_t sampleCount)
{
// Get next sequence descriptions.
Sequences result;
Expand Down Expand Up @@ -136,7 +136,7 @@ Sequences PartialBlockRandomizer::GetNextSequences(size_t sampleCount)

// Get next sequence descriptions that do not exceed sample count.
// Returns true if epoch end is reached.
bool PartialBlockRandomizer::GetNextSequenceDescriptions(size_t sampleCount, std::vector<RandomizedSequenceDescription>& result)
bool BlockRandomizer::GetNextSequenceDescriptions(size_t sampleCount, std::vector<RandomizedSequenceDescription>& result)
{
PrepareNewSweepIfNeeded(m_globalSamplePosition);

Expand Down Expand Up @@ -166,7 +166,7 @@ bool PartialBlockRandomizer::GetNextSequenceDescriptions(size_t sampleCount, std
}

// Decimates sequences and load/unloads chunks using infromation of the SequenceRandomizer.
void PartialBlockRandomizer::Decimate(const std::vector<RandomizedSequenceDescription>& all, std::vector<RandomizedSequenceDescription>& decimated)
void BlockRandomizer::Decimate(const std::vector<RandomizedSequenceDescription>& all, std::vector<RandomizedSequenceDescription>& decimated)
{
// Swap remove all old chunks and add new ones.
// Require all data in chunks.
Expand Down Expand Up @@ -202,7 +202,7 @@ void PartialBlockRandomizer::Decimate(const std::vector<RandomizedSequenceDescri
}

// Retrives chunk data based on the window information provided by SequenceRandomizer
void PartialBlockRandomizer::RetrieveDataChunks()
void BlockRandomizer::RetrieveDataChunks()
{
const auto& window = m_sequenceRandomizer->GetChunkWindow();
if (window.back().m_chunkId == m_lastSeenChunkId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
// Actual randomization happens in ChunkRandomizer and SequenceRandomizer.
// TODO: The behavior can be simplified by only randomizing sequences forward.
// TODO: The layering will be changed, when we move transformers under the randomizer, it won't be a transformer anymore.
class PartialBlockRandomizer : public Transformer
class BlockRandomizer : public Transformer
{
public:
// Currently, decimation based on sequences or chunks is supported.
Expand All @@ -42,7 +42,7 @@ class PartialBlockRandomizer : public Transformer
sequence
};

PartialBlockRandomizer(
BlockRandomizer(
int verbosity,
size_t randomizationRangeInSamples,
IDataDeserializerPtr deserializer,
Expand Down
4 changes: 2 additions & 2 deletions Source/Readers/ReaderLib/ReaderLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<ClInclude Include="Bundler.h" />
<ClInclude Include="ChunkRandomizer.h" />
<ClInclude Include="DataDeserializerBase.h" />
<ClInclude Include="PartialBlockRandomizer.h" />
<ClInclude Include="BlockRandomizer.h" />
<ClInclude Include="SequenceRandomizer.h" />
<ClInclude Include="TransformerBase.h" />
<ClInclude Include="NoRandomizer.h" />
Expand All @@ -98,7 +98,7 @@
<ClCompile Include="Bundler.cpp" />
<ClCompile Include="ChunkRandomizer.cpp" />
<ClCompile Include="NoRandomizer.cpp" />
<ClCompile Include="PartialBlockRandomizer.cpp" />
<ClCompile Include="BlockRandomizer.cpp" />
<ClCompile Include="SampleModePacker.cpp" />
<ClCompile Include="ReaderShim.cpp" />
<ClCompile Include="SequenceRandomizer.cpp" />
Expand Down
12 changes: 6 additions & 6 deletions Source/Readers/ReaderLib/ReaderLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
<ClInclude Include="Bundler.h">
<Filter>Deserializers</Filter>
</ClInclude>
<ClInclude Include="PartialBlockRandomizer.h">
<Filter>Randomizers</Filter>
</ClInclude>
<ClInclude Include="ChunkRandomizer.h">
<Filter>Randomizers</Filter>
</ClInclude>
<ClInclude Include="SequenceRandomizer.h">
<Filter>Randomizers</Filter>
</ClInclude>
<ClInclude Include="BlockRandomizer.h">
<Filter>Randomizers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="NoRandomizer.cpp">
Expand All @@ -63,15 +63,15 @@
<ClCompile Include="Bundler.cpp">
<Filter>Deserializers</Filter>
</ClCompile>
<ClCompile Include="PartialBlockRandomizer.cpp">
<Filter>Randomizers</Filter>
</ClCompile>
<ClCompile Include="ChunkRandomizer.cpp">
<Filter>Randomizers</Filter>
</ClCompile>
<ClCompile Include="SequenceRandomizer.cpp">
<Filter>Randomizers</Filter>
</ClCompile>
<ClCompile Include="BlockRandomizer.cpp">
<Filter>Randomizers</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Interfaces">
Expand Down
16 changes: 8 additions & 8 deletions Tests/UnitTests/ReaderTests/ReaderLibTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "NoRandomizer.h"
#include "DataDeserializer.h"
#include "PartialBlockRandomizer.h"
#include "BlockRandomizer.h"

using namespace Microsoft::MSR::CNTK;

Expand Down Expand Up @@ -148,20 +148,20 @@ class MockDeserializer : public IDataDeserializer
MockDeserializer& operator=(const MockDeserializer&) = delete;
};

BOOST_AUTO_TEST_CASE(PartialBlockRandomizerInstantiate)
BOOST_AUTO_TEST_CASE(BlockRandomizerInstantiate)
{
std::vector<float> data;
auto mockDeserializer = std::make_shared<MockDeserializer>(0, 0, data);

auto randomizer = std::make_shared<PartialBlockRandomizer>(0, SIZE_MAX, mockDeserializer, PartialBlockRandomizer::DecimationMode::chunk, false);
auto randomizer = std::make_shared<BlockRandomizer>(0, SIZE_MAX, mockDeserializer, BlockRandomizer::DecimationMode::chunk, false);
}

BOOST_AUTO_TEST_CASE(PartialBlockRandomizerOneEpoch)
BOOST_AUTO_TEST_CASE(BlockRandomizerOneEpoch)
{
std::vector<float> data { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
auto mockDeserializer = std::make_shared<MockDeserializer>(5, 2, data);

auto randomizer = std::make_shared<PartialBlockRandomizer>(0, SIZE_MAX, mockDeserializer, PartialBlockRandomizer::DecimationMode::chunk, false);
auto randomizer = std::make_shared<BlockRandomizer>(0, SIZE_MAX, mockDeserializer, BlockRandomizer::DecimationMode::chunk, false);

EpochConfiguration epochConfiguration;
epochConfiguration.m_numberOfWorkers = 1;
Expand Down Expand Up @@ -189,15 +189,15 @@ BOOST_AUTO_TEST_CASE(PartialBlockRandomizerOneEpoch)
actual.begin(), actual.end());
}

BOOST_AUTO_TEST_CASE(PartialBlockRandomizerOneEpochLegacyRandomization)
BOOST_AUTO_TEST_CASE(BlockRandomizerOneEpochLegacyRandomization)
{
std::vector<float> data { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
auto mockDeserializer = std::make_shared<MockDeserializer>(5, 2, data);

auto randomizer = std::make_shared<PartialBlockRandomizer>(0,
auto randomizer = std::make_shared<BlockRandomizer>(0,
SIZE_MAX,
mockDeserializer,
PartialBlockRandomizer::DecimationMode::sequence,
BlockRandomizer::DecimationMode::sequence,
true);

EpochConfiguration epochConfiguration;
Expand Down

0 comments on commit 26b94ed

Please sign in to comment.