Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ elseif(WIN32) # MSVC
# include specific flags for release and debug modes.
set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE}
/Ox /Oi /Ot /Oy /GL /fp:fast /GS- /bigobj /LTCG")
set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} /bigobj")
add_definitions(-D _CRT_SECURE_NO_WARNINGS)
endif()

Expand Down
15 changes: 9 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ init:
environment:
home: C:\projects
cmake: C:\projects\cmake-3.4.1-win32-x86\bin\cmake.exe
matrix:
- msvc: 14
- msvc: 12

version: '{branch}-{build}'

Expand All @@ -22,13 +25,13 @@ install:
configuration: Release

before_build:
- cmd: mkdir build
- cmd: cd build
- cmd: '%cmake% -G "Visual Studio 14 Win64" -DUSE_SSE=ON -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=..\install ..\tiny-dnn'
- cmd: mkdir build_vc%msvc%
- cmd: cd build_vc%msvc%
- cmd: '%cmake% -G "Visual Studio %msvc% Win64" -DUSE_SSE=ON -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=..\install ..\tiny-dnn'

after_build:
- cmd: 'cd C:\projects\build\test\Release'
- cmd: 'cd C:\projects\build_vc%msvc%\test\Release'
- cmd: tiny_dnn_test.exe

build:
project: C:\projects\build\tiny_dnn.sln
build_script:
- msbuild C:\projects\build_vc%msvc%\tiny_dnn.sln
42 changes: 42 additions & 0 deletions tiny_dnn/util/macro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Copyright (c) 2016, Taiga Nomi
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the tiny-dnn nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once

#define CNN_UNREFERENCED_PARAMETER(x) (void)(x)

#if defined(_MSC_VER) && (_MSC_VER <= 1800)
// msvc2013 doesn't have move constructor
#define CNN_DEFAULT_MOVE_CONSTRUCTOR_UNAVAILABLE
#define CNN_DEFAULT_ASSIGNMENT_OPERATOR_UNAVAILABLE
#endif

#if defined(_MSC_VER) && (_MSC_VER <= 1800)
// msvc2013 doesn't have alignof operator
#define CNN_ALIGNOF(x) __alignof(x)
#else
#define CNN_ALIGNOF(x) alignof(x)
#endif
3 changes: 2 additions & 1 deletion tiny_dnn/util/serialization_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <cereal/archives/json.hpp>
#include <cereal/types/memory.hpp>
#include "tiny_dnn/util/nn_error.h"
#include "tiny_dnn/util/macro.h"

namespace tiny_dnn {

Expand Down Expand Up @@ -104,7 +105,7 @@ namespace detail {
template <typename InputArchive, typename T>
std::shared_ptr<T> load_layer_impl(InputArchive& ia) {

using ST = typename std::aligned_storage<sizeof(T), alignof(T)>::type;
using ST = typename std::aligned_storage<sizeof(T), CNN_ALIGNOF(T)>::type;

auto valid = std::make_shared<bool>(false);

Expand Down
10 changes: 2 additions & 8 deletions tiny_dnn/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
#include <cereal/cereal.hpp>
#include <cereal/archives/json.hpp>
#include <cereal/archives/binary.hpp>
#include <cereal/types/polymorphic.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/deque.hpp>

#include "tiny_dnn/config.h"
#include "tiny_dnn/util/macro.h"
#include "tiny_dnn/util/aligned_allocator.h"
#include "tiny_dnn/util/nn_error.h"
#include "tiny_dnn/util/parallel_for.h"
Expand All @@ -58,8 +59,6 @@
#endif
#endif

#define CNN_UNREFERENCED_PARAMETER(x) (void)(x)

namespace tiny_dnn {

///< output label(class-index) for classification
Expand Down Expand Up @@ -387,9 +386,4 @@ inline void printAvailableDevice(const cnn_size_t platform_id,
#endif
}

#if defined(_MSC_VER) && (_MSC_VER <= 1800)
#define CNN_DEFAULT_MOVE_CONSTRUCTOR_UNAVAILABLE
#define CNN_DEFAULT_ASSIGNMENT_OPERATOR_UNAVAILABLE
#endif

} // namespace tiny_dnn
3 changes: 2 additions & 1 deletion vc/vc12/tiny_cnn.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand All @@ -108,7 +109,7 @@
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/D_VARIADIC_MAX=10 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/D_VARIADIC_MAX=10 /bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
2 changes: 2 additions & 0 deletions vc/vc12/tiny_cnn_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand All @@ -68,6 +69,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_MBCS;CNN_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
4 changes: 3 additions & 1 deletion vc/vc14/tiny_cnn.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand All @@ -176,10 +177,11 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<PreprocessorDefinitions>_MBCS;CNN_USE_AVX;CNN_USE_TBB;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_MBCS;CNN_USE_AVX;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
2 changes: 1 addition & 1 deletion vc/vc14/tiny_cnn_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_MBCS;CNN_USE_TBB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
Expand Down