Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the targeted TensorFlow version to 2.17 #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FROM tensorflow/tensorflow:2.7.3-gpu
FROM tensorflow/tensorflow:2.17.0-gpu

# Need cmake to build the op
RUN apt-get update && apt-get -y install \
cmake \
libtcmalloc-minimal4
libtcmalloc-minimal4 \
&& rm -rf /var/lib/apt/lists/*

# Need these libraries for training
RUN pip3 install \
Expand All @@ -35,18 +36,18 @@ RUN install -d -m 0777 /.cache/matplotlib
# Build the tensorflow op and put it in /visualmesh
RUN mkdir visualmesh
COPY . visualmesh/
ENV CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0
RUN mkdir visualmesh/build && cd visualmesh/build \
&& cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_EXAMPLES=Off \
-DBUILD_OPENCL_ENGINE=Off \
-DBUILD_TENSORFLOW_OP=On \
&& make

ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4

# Make tensorflow only print out info and above logs
ENV TF_CPP_MIN_LOG_LEVEL 1
ENV TF_CPP_MIN_LOG_LEVEL=1

RUN mkdir /workspace
WORKDIR /workspace
2 changes: 1 addition & 1 deletion cmake/Modules/FindTensorFlow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ find_path(

find_library(
TENSORFLOW_LIBRARIES
NAMES tensorflow_framework libtensorflow_framework.so.2 libtensorflow_framework.so.1
NAMES tensorflow_framework libtensorflow_framework.so.2 libtensorflow_framework.so.1 libtensorflow_framework.2.dylib
HINTS ${tf_lib_dir}
DOC "TensorFlow library")

Expand Down
1 change: 1 addition & 0 deletions tensorflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ find_package(TensorFlow REQUIRED)

add_library(tf_op SHARED "map.cpp" "unmap.cpp" "lookup.cpp" "difference.cpp" ${hdr})
target_compile_options(tf_op PRIVATE -march=native -mtune=native)
target_compile_features(tf_op PRIVATE cxx_std_17)
set_target_properties(
tf_op
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/training/op"
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/difference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ REGISTER_OP("DifferenceVisualMesh")
.Output("vectors: T")
.SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
c->set_output(Outputs::DIFFERENCES, c->input(Args::COORDINATES_A));
return tensorflow::Status::OK();
return tensorflow::OkStatus();
});

/**
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ REGISTER_OP("LookupVisualMesh")
// nx2 vectors on image, n+1xG neighbours (including off screen point), and n global indices
c->set_output(Outputs::VECTORS, c->MakeShape({kUnknownDim, 3}));
c->set_output(Outputs::NEIGHBOURS, c->MakeShape({kUnknownDim, kUnknownDim}));
return tensorflow::Status::OK();
return tensorflow::OkStatus();
});

/**
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ REGISTER_OP("MapVisualMesh")
.Output("vectors: T")
.SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
c->set_output(Outputs::VECTORS, c->Matrix(c->Dim(c->input(Args::COORDINATES), 0), 3));
return tensorflow::Status::OK();
return tensorflow::OkStatus();
});

/**
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/unmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ REGISTER_OP("UnmapVisualMesh")
.Output("coordinates: T")
.SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
c->set_output(Outputs::COORDINATES, c->Matrix(c->Dim(c->input(Args::VECTORS), 0), 2));
return tensorflow::Status::OK();
return tensorflow::OkStatus();
});

/**
Expand Down
2 changes: 1 addition & 1 deletion training/dataset/visual_mesh_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def build(self):
dataset = dataset.filter(lambda args: tf.reduce_all(args["valid"]))

# Perform a ragged batch
dataset = dataset.apply(tf.data.experimental.dense_to_ragged_batch(batch_size=self.batch_size))
dataset = dataset.ragged_batch(batch_size=self.batch_size)

# Perform actions needed to convert the ragged batches into training examples
dataset = dataset.map(self._reduce, num_parallel_calls=self.prefetch)
Expand Down
2 changes: 1 addition & 1 deletion training/metrics/test/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def curve_bucket(x, y):
return tf.math.sqrt(tf.add(tf.math.squared_difference(x[:-1], x[1:]), tf.math.squared_difference(y[:-1], y[1:]),))
return tf.math.sqrt(tf.add(tf.math.squared_difference(x[:-1], x[1:]), tf.math.squared_difference(y[:-1], y[1:])))


def x_bucket(x, y):
Expand Down