Skip to content

Instantly share code, notes, and snippets.

@ivelin
Created June 19, 2019 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivelin/ca00faf00b44ac537d4faddde3fc23f2 to your computer and use it in GitHub Desktop.
Save ivelin/ca00faf00b44ac537d4faddde3fc23f2 to your computer and use it in GitHub Desktop.
#include "tensorflow/core/framework/common_shape_fns.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"
namespace tensorflow {
REGISTER_OP("PcapInput")
.Input("source: string")
.Output("handle: variant")
.Attr("filters: list(string) = []")
.Attr("columns: list(string) = []")
.Attr("schema: string = ''")
.SetShapeFn([](shape_inference::InferenceContext* c) {
c->set_output(0, c->MakeShape({c->UnknownDim()}));
return Status::OK();
});
REGISTER_OP("PcapDataset")
.Input("input: T")
.Input("batch: int64")
.Output("handle: variant")
.Attr("output_types: list(type) >= 1")
.Attr("output_shapes: list(shape) >= 1")
.Attr("T: {string, variant} = DT_VARIANT")
.SetIsStateful()
.SetShapeFn([](shape_inference::InferenceContext* c) {
c->set_output(0, c->MakeShape({}));
return Status::OK();
});
} // namespace tensorflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment