Skip to content

Commit 7b10aec

Browse files
committed
Use AZ::IO::Path to represent filenames
Signed-off-by: kberg-amzn <[email protected]>
1 parent 4ad254e commit 7b10aec

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

Gems/MachineLearning/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#
2+
# Copyright (c) Contributors to the Open 3D Engine Project.
3+
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
4+
#
5+
# SPDX-License-Identifier: Apache-2.0 OR MIT
6+
#
7+
#
18

29
# Query the gem name from the gem.json file if possible
310
# otherwise fallback to using MachineLearning

Gems/MachineLearning/Code/Include/MachineLearning/ILabeledTrainingData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace MachineLearning
2020
virtual ~ILabeledTrainingData() = default;
2121

2222
//! Loads the indicated label and data files.
23-
virtual bool LoadArchive(const AZStd::string& imageFilename, const AZStd::string& labelFilename) = 0;
23+
virtual bool LoadArchive(const AZ::IO::Path& imageFilename, const AZ::IO::Path& labelFilename) = 0;
2424

2525
//! Returns the total number of samples contained in the training data set.
2626
virtual AZStd::size_t GetSampleCount() const = 0;

Gems/MachineLearning/Code/Source/Assets/MnistDataLoader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <AzCore/RTTI/BehaviorContext.h>
1919
#include <AzCore/Serialization/EditContext.h>
2020
#include <AzCore/Serialization/SerializeContext.h>
21-
#pragma optimize("", off)
21+
2222
namespace MachineLearning
2323
{
2424
void MnistDataLoader::Reflect(AZ::ReflectContext* context)
@@ -50,7 +50,7 @@ namespace MachineLearning
5050
}
5151
}
5252

53-
bool MnistDataLoader::LoadArchive(const AZStd::string& imageFilename, const AZStd::string& labelFilename)
53+
bool MnistDataLoader::LoadArchive(const AZ::IO::Path& imageFilename, const AZ::IO::Path& labelFilename)
5454
{
5555
return LoadImageFile(imageFilename) && LoadLabelFile(labelFilename);
5656
}
@@ -77,7 +77,7 @@ namespace MachineLearning
7777
return m_imageVector;
7878
}
7979

80-
bool MnistDataLoader::LoadImageFile(const AZStd::string& imageFilename)
80+
bool MnistDataLoader::LoadImageFile(const AZ::IO::Path& imageFilename)
8181
{
8282
AZ::IO::FixedMaxPath filePathFixed = imageFilename.c_str();
8383
if (AZ::IO::FileIOBase* fileIOBase = AZ::IO::FileIOBase::GetInstance())
@@ -130,7 +130,7 @@ namespace MachineLearning
130130
return true;
131131
}
132132

133-
bool MnistDataLoader::LoadLabelFile(const AZStd::string& labelFilename)
133+
bool MnistDataLoader::LoadLabelFile(const AZ::IO::Path& labelFilename)
134134
{
135135
AZ::IO::FixedMaxPath filePathFixed = labelFilename.c_str();
136136
if (AZ::IO::FileIOBase* fileIOBase = AZ::IO::FileIOBase::GetInstance())
@@ -195,4 +195,4 @@ namespace MachineLearning
195195
return true;
196196
}
197197
}
198-
#pragma optimize("", on)
198+

Gems/MachineLearning/Code/Source/Assets/MnistDataLoader.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ namespace MachineLearning
3232

3333
//! ILabeledTrainingData interface
3434
//! @{
35-
bool LoadArchive(const AZStd::string& imageFilename, const AZStd::string& labelFilename) override;
35+
bool LoadArchive(const AZ::IO::Path& imageFilename, const AZ::IO::Path& labelFilename) override;
3636
AZStd::size_t GetSampleCount() const override;
3737
const AZ::VectorN& GetLabelByIndex(AZStd::size_t index) override;
3838
const AZ::VectorN& GetDataByIndex(AZStd::size_t index) override;
3939
//! @}
4040

4141
private:
4242

43-
bool LoadImageFile(const AZStd::string& imageFilename);
44-
bool LoadLabelFile(const AZStd::string& labelFilename);
43+
bool LoadImageFile(const AZ::IO::Path& imageFilename);
44+
bool LoadLabelFile(const AZ::IO::Path& labelFilename);
4545

4646
struct MnistDataHeader
4747
{

Gems/MachineLearning/Code/Source/Assets/TrainingDataView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace MachineLearning
5252
std::shuffle(m_indices.begin(), m_indices.end(), std::mt19937(std::random_device{}()));
5353
}
5454

55-
bool TrainingDataView::LoadArchive(const AZStd::string& imageFilename, const AZStd::string& labelFilename)
55+
bool TrainingDataView::LoadArchive(const AZ::IO::Path& imageFilename, const AZ::IO::Path& labelFilename)
5656
{
5757
AZ_Assert(m_sourceData, "No datasource assigned to view");
5858
bool result = m_sourceData->LoadArchive(imageFilename, labelFilename);

Gems/MachineLearning/Code/Source/Assets/TrainingDataView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace MachineLearning
3838

3939
//! ILabeledTrainingData interface
4040
//! @{
41-
bool LoadArchive(const AZStd::string& imageFilename, const AZStd::string& labelFilename) override;
41+
bool LoadArchive(const AZ::IO::Path& imageFilename, const AZ::IO::Path& labelFilename) override;
4242
AZStd::size_t GetSampleCount() const override;
4343
const AZ::VectorN& GetLabelByIndex(AZStd::size_t index) override;
4444
const AZ::VectorN& GetDataByIndex(AZStd::size_t index) override;

0 commit comments

Comments
 (0)