Skip to content

Commit d13242f

Browse files
committed
update to tf2.*
1 parent b3fe700 commit d13242f

17 files changed

+32
-26
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if(UNIX AND NOT APPLE)
2828
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/tensorflow/lib/libtensorflow.so)
2929
file(
3030
DOWNLOAD
31-
https://github.com/Neargye/tensorflow/releases/download/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz ${CMAKE_SOURCE_DIR}/tensorflow/linux.tar.gz
31+
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.7.0.tar.gz ${CMAKE_SOURCE_DIR}/tensorflow/linux.tar.gz
3232
STATUS
3333
status
3434
LOG
@@ -51,7 +51,7 @@ elseif(APPLE)
5151
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/tensorflow/lib/libtensorflow.so)
5252
file(
5353
DOWNLOAD
54-
https://github.com/Neargye/tensorflow/releases/download/v1.15.0/libtensorflow-cpu-darwin-x86_64-1.15.0.tar.gz ${CMAKE_SOURCE_DIR}/tensorflow/darwin.tar.gz
54+
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-2.7.0.tar.gz ${CMAKE_SOURCE_DIR}/tensorflow/darwin.tar.gz
5555
STATUS
5656
status
5757
LOG
@@ -75,7 +75,7 @@ elseif(WIN32)
7575
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/tensorflow/lib/tensorflow.dll)
7676
file(
7777
DOWNLOAD
78-
https://github.com/Neargye/tensorflow/releases/download/v1.15.0/libtensorflow-cpu-windows-x86_64-1.15.0.zip ${CMAKE_SOURCE_DIR}/tensorflow/windows.zip
78+
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip ${CMAKE_SOURCE_DIR}/tensorflow/windows.zip
7979
STATUS
8080
status
8181
LOG

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 - 2020 Daniil Goncharov
3+
Copyright (c) 2018 - 2024 Daniil Goncharov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ cmake --build .
5959

6060
## Get tensorflow lib
6161

62-
For x64 CPU, you can download the tensorflow.so, tensorflow.dll and tensorflow.lib from <https://github.com/neargye-forks/tensorflow/releases>.
62+
For x64 CPU, you can download the tensorflow.so, tensorflow.dll and tensorflow.lib from https://www.tensorflow.org/install/lang_c.
6363

6464
Or build lib which version you need from the sources, with CPU or GPU support.
6565

src/3rdparty/scope_guard/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 - 2020 Daniil Goncharov
3+
Copyright (c) 2018 - 2024 Daniil Goncharov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/3rdparty/scope_guard/include/scope_guard.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
1111
// SPDX-License-Identifier: MIT
12-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
12+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
1313
//
1414
// Permission is hereby granted, free of charge, to any person obtaining a copy
1515
// of this software and associated documentation files (the "Software"), to deal

src/allocate_tensor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/batch_interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/create_tensor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/graph_info.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/hello_tf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/load_graph.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/session_run.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/tensor_info.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

src/tf_utils.cpp

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,10 @@ static void DeallocateBuffer(void* data, size_t) {
3636
std::free(data);
3737
}
3838

39+
static void Deallocator(void*, size_t, void*) {
40+
//std::free(data);
41+
}
42+
3943
static TF_Buffer* ReadBufferFromFile(const char* file) {
4044
std::ifstream f(file, std::ios::binary);
4145
SCOPE_EXIT{ f.close(); };
@@ -68,13 +72,15 @@ static TF_Buffer* ReadBufferFromFile(const char* file) {
6872
return buf;
6973
}
7074

71-
TF_Tensor* ScalarStringTensor(const char* str, TF_Status* status) {
75+
TF_Tensor* ScalarStringTensor(const char* str, TF_Status*) {
7276
auto str_len = std::strlen(str);
73-
auto nbytes = 8 + TF_StringEncodedSize(str_len); // 8 extra bytes - for start_offset.
74-
auto tensor = TF_AllocateTensor(TF_STRING, nullptr, 0, nbytes);
75-
auto data = static_cast<char*>(TF_TensorData(tensor));
76-
std::memset(data, 0, 8);
77-
TF_StringEncode(str, str_len, data + 8, nbytes - 8, status);
77+
TF_TString tstring[1];
78+
TF_TString_Init(&tstring[0]);
79+
TF_TString_Copy(&tstring[0], str, str_len);
80+
int64_t dims[] = { 1,1 };
81+
int num_dims = 1;
82+
TF_Tensor* tensor = TF_NewTensor(TF_STRING, dims, num_dims, &tstring[0], sizeof(tstring), &Deallocator, nullptr);
83+
7884
return tensor;
7985
}
8086

src/tf_utils.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal

test/test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22
// SPDX-License-Identifier: MIT
3-
// Copyright (c) 2018 - 2020 Daniil Goncharov <[email protected]>.
3+
// Copyright (c) 2018 - 2024 Daniil Goncharov <[email protected]>.
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal
@@ -39,5 +39,5 @@
3939
#endif
4040

4141
TEST_CASE("Hello TF C API") {
42-
REQUIRE(std::string(TF_Version()) == std::string("1.15.0"));
42+
REQUIRE(std::string(TF_Version()) == std::string("2.7.0"));
4343
}

0 commit comments

Comments
 (0)