最近,在看TensoFlow源码时,看到链式编程的代码,贴出来一点:
#include "tensorflow/core/framework/common_shape_fns.h"
#include "tensorflow/core/framework/numeric_op.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"
namespace tensorflow {
REGISTER_OP("Invert")
.Input("x: T")
.Output("y: T")
.Attr("T: {int8, int16, int32, int64, uint8, uint16, uint32, uint64}")
.SetShapeFn(shape_inference::UnchangedShape);
#define BINARY_BITWISE() \
Input("x: T") \
.Input("y: T") \
.Output("z: T") \
.Attr("T: {int8, int16, int32, int64, uint8, uint16, uint32, uint64}") \