forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new contrib/avro directory and the initial schema that resembles
tf.train.Example. Change: 123445810
- Loading branch information
1 parent
c922ed6
commit dedaa43
Showing
11 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
||
prefix_dir = "avro-cpp-1.8.0" | ||
|
||
cc_library( | ||
name = "avrocpp", | ||
srcs = glob( | ||
[ | ||
prefix_dir + "/impl/**/*.cc", | ||
prefix_dir + "/impl/**/*.hh", | ||
], | ||
exclude = [ | ||
prefix_dir + "/impl/avrogencpp.cc", | ||
], | ||
), | ||
hdrs = glob([prefix_dir + "/api/**/*.hh"]), | ||
includes = [prefix_dir + "/api"], | ||
deps = [ | ||
"@boost_archive//:boost", | ||
"@boost_archive//:filesystem", | ||
"@boost_archive//:iostreams", | ||
"@boost_archive//:system", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "avrogencpp", | ||
srcs = [prefix_dir + "/impl/avrogencpp.cc"], | ||
deps = [ | ||
":avrocpp", | ||
"@boost_archive//:program_options", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Description: | ||
# The Boost library collection (http://www.boost.org) | ||
# | ||
# Most Boost libraries are header-only, in which case you only need to depend | ||
# on :boost. If you need one of the libraries that has a separately-compiled | ||
# implementation, depend on the appropriate libs rule. | ||
|
||
# This is only needed for Avro. | ||
package(default_visibility = ["@avro_archive//:__subpackages__"]) | ||
|
||
licenses(["notice"]) # Boost software license | ||
|
||
prefix_dir = "boost_1_61_0" | ||
|
||
cc_library( | ||
name = "boost", | ||
hdrs = glob([ | ||
prefix_dir + "/boost/**/*.hpp", | ||
prefix_dir + "/boost/**/*.h", | ||
prefix_dir + "/boost/**/*.ipp", | ||
]), | ||
includes = [prefix_dir], | ||
) | ||
|
||
cc_library( | ||
name = "filesystem", | ||
srcs = glob([prefix_dir + "/libs/filesystem/src/*.cpp"]), | ||
deps = [ | ||
":boost", | ||
":system", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "iostreams", | ||
srcs = glob([prefix_dir + "/libs/iostreams/src/*.cpp"]), | ||
deps = [ | ||
":boost", | ||
"@bzip2_archive//:bz2lib", | ||
"@zlib_archive//:zlib", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "program_options", | ||
srcs = glob([prefix_dir + "/libs/program_options/src/*.cpp"]), | ||
deps = [ | ||
":boost", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "system", | ||
srcs = glob([prefix_dir + "/libs/system/src/*.cpp"]), | ||
deps = [ | ||
":boost", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) # BSD derivative | ||
|
||
prefix_dir = "bzip2-1.0.6" | ||
|
||
BZ2LIB_SRCS = [ | ||
# these are in the same order as their corresponding .o files are in OBJS in | ||
# Makefile (rather than lexicographic order) for easy comparison (that they | ||
# are identical). | ||
"blocksort.c", | ||
"huffman.c", | ||
"crctable.c", | ||
"randtable.c", | ||
"compress.c", | ||
"decompress.c", | ||
"bzlib.c", | ||
] | ||
|
||
cc_library( | ||
name = "bz2lib", | ||
srcs = [prefix_dir + "/" + source for source in BZ2LIB_SRCS] + | ||
[prefix_dir + "/bzlib_private.h"], | ||
hdrs = [prefix_dir + "/bzlib.h"], | ||
includes = [prefix_dir], | ||
) | ||
|
||
cc_binary( | ||
name = "bzip2", | ||
srcs = [ | ||
"bzip2.c", | ||
], | ||
deps = [ | ||
":bz2lib", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Description: | ||
# Contains ops for reading and writing Apache Avro files. | ||
# (https://avro.apache.org/) | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
||
exports_files(["LICENSE"]) | ||
|
||
package(default_visibility = ["//tensorflow:__subpackages__"]) | ||
|
||
load("//third_party/avro:build_defs.bzl", "avro_gen_cpp") | ||
|
||
avro_gen_cpp( | ||
name = "example_h", | ||
srcs = ["example.json"], | ||
outs = ["example.h"], | ||
namespace = "tensorflow", | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = [ | ||
"**/METADATA", | ||
"**/OWNERS", | ||
], | ||
), | ||
visibility = ["//tensorflow:__subpackages__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# TensorFlow Avro support | ||
|
||
This directory contains code for reading and writing | ||
[Apache Avro](https://avro.apache.org/) data in TensorFlow. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"type": "record", | ||
"name": "Example", | ||
"fields": [ | ||
{ | ||
"name": "features", | ||
"type": { | ||
"type": "record", | ||
"name": "Features", | ||
"fields": [ | ||
{ | ||
"name": "feature", | ||
"type": { | ||
"type": "map", | ||
"values": { | ||
"type": "record", | ||
"name": "Feature", | ||
"fields": [ | ||
{ | ||
"name": "values", | ||
"type": [ | ||
{ | ||
"type": "record", | ||
"name": "BytesList", | ||
"fields": [ | ||
{ | ||
"name": "value", | ||
"type": { | ||
"type": "array", | ||
"items": "bytes" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "FloatList", | ||
"fields": [ | ||
{ | ||
"name": "value", | ||
"type": { | ||
"type": "array", | ||
"items": "float" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "record", | ||
"name": "Int64List", | ||
"fields": [ | ||
{ | ||
"name": "value", | ||
"type": { | ||
"type": "array", | ||
"items": "long" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Build extension for generating C++ header file from an Avro schema. | ||
Example usage: | ||
load("//third_party/avro:build_defs.bzl", "avro_gen_cpp") | ||
avro_gen_cpp( | ||
name = "myrule", | ||
srcs = ["myschema.json"], | ||
outs = ["myschema.h"], | ||
namespace = "mynamespace", | ||
) | ||
""" | ||
|
||
def avro_gen_cpp(name, srcs, outs, namespace, visibility=None): | ||
native.genrule( | ||
name = name, | ||
srcs = srcs, | ||
outs = outs, | ||
cmd = ("$(location @avro_archive//:avrogencpp)" + | ||
" --include-prefix external/avro_archive/avro-cpp-1.8.0/api" + | ||
" --namespace " + namespace + | ||
" --no-union-typedef" + | ||
" --input $(SRCS)" + | ||
" --output $@"), | ||
tools = ["@avro_archive//:avrogencpp"], | ||
visibility = visibility, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) # BSD/MIT-like license (for zlib) | ||
|
||
prefix_dir = "zlib-1.2.8" | ||
|
||
cc_library( | ||
name = "zlib", | ||
srcs = glob([prefix_dir + "/*.c"]), | ||
hdrs = glob([prefix_dir + "/*.h"]), | ||
includes = [prefix_dir], | ||
) |