class tensorflow::fold::WeaverOpBase

January 26, 2017 ยท View on GitHub

WeaverOpBase is a base class for writing TensorFlow ops kernels that schedule ops for Loom.

Operations created as subclasses of WeaverOpBase should be registered with the REGISTER_WEAVER_OP macro. For example, DeserializingWeaverOp is registered using:

REGISTER_WEAVER_OP("DeserializingWeaver").Input("weaver_messages: string");

And

REGISTER_KERNEL_BUILDER(
    Name("DeserializingWeaver").Device(tensorflow::DEVICE_CPU),
    DeserializingWeaverOp);

###Member Details

tensorflow::fold::WeaverOpBase::WeaverOpBase(tensorflow::OpKernelConstruction *c)

Reads the metadata, constant_types, and num_types_shapes attributes and makes sure they're consistent. Dies if they're not.

virtual tensorflow::Status tensorflow::fold::WeaverOpBase::Weave(tensorflow::OpKernelContext *c, Weaver *weaver)=0

Weave is a virtual method, to be subclassed. Weave's responsibility is to read the ops inputs and use the weaver to schedule LoomOps to be executed on the loom. Weave should not call Weaver::Finalize.

void tensorflow::fold::WeaverOpBase::Compute(tensorflow::OpKernelContext *c) override

Dispatches to Weave to build a Weaver, which is then used to build the wiring diagram and constant tensors that the loom needs.