Skip to content

方法链调用 #3

Description

@dinghaodhd

REGISTER_OP("Invert")
.Input("x: T")
.Output("y: T")
.Attr("T: {int8, int16, int32, int64, uint8, uint16, uint32, uint64}")
.SetShapeFn(shape_inference::UnchangedShape)
.Doc(R"doc(
Flips all bits elementwise.

The result will have exactly those bits set, that are not set in x. The
computation is performed on the underlying representation of x.
)doc");

template <>
class OpDefBuilderWrapper {
public:
OpDefBuilderWrapper(const char name[]) : builder_(name) {}
OpDefBuilderWrapper& Attr(StringPiece spec) {
builder_.Attr(spec);
return *this;
}
OpDefBuilderWrapper& Input(StringPiece spec) {
builder_.Input(spec);
return *this;
}
OpDefBuilderWrapper& Output(StringPiece spec) {
builder_.Output(spec);
return *this;
}
OpDefBuilderWrapper& SetIsCommutative() {
builder_.SetIsCommutative();
return *this;
}
OpDefBuilderWrapper& SetIsAggregate() {
builder_.SetIsAggregate();
return *this;
}
OpDefBuilderWrapper& SetIsStateful() {
builder_.SetIsStateful();
return *this;
}
OpDefBuilderWrapper& SetAllowsUninitializedInput() {
builder_.SetAllowsUninitializedInput();
return *this;
}
OpDefBuilderWrapper& Deprecated(int version, StringPiece explanation) {
builder_.Deprecated(version, explanation);
return *this;
}
OpDefBuilderWrapper& Doc(StringPiece text) {
builder_.Doc(text);
return *this;
}
OpDefBuilderWrapper& SetShapeFn(
Status (fn)(shape_inference::InferenceContext)) {
builder_.SetShapeFn(fn);
return *this;
}
const ::tensorflow::OpDefBuilder& builder() const { return builder_; }

private:
mutable ::tensorflow::OpDefBuilder builder_;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions