MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ConcatGrad

Function ConcatGrad

tensorflow/core/ops/array_grad_test.cc:117–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117std::vector<Tensor> ConcatGrad(int dim, const Tensor& x0, const Tensor& x1,
118 const Tensor& dy) {
119 auto T = DT_FLOAT;
120 auto gdef = test::function::GDef(
121 {f::NDef("dim", "Placeholder", {}, {{"dtype", DT_INT32}}),
122 f::NDef("x0", "Placeholder", {}, {{"dtype", T}}),
123 f::NDef("x1", "Placeholder", {}, {{"dtype", T}}),
124 f::NDef("dy", "Placeholder", {}, {{"dtype", T}}),
125 f::NDef("dx", "SymbolicGradient", {"dim", "x0", "x1", "dy"},
126 {{"f", FDH::FunctionRef("Concat", {{"N", 2}, {"T", T}})},
127 {"Tin", DataTypeSlice{DT_INT32, T, T, T}},
128 {"Tout", DataTypeSlice{DT_INT32, T, T}}})});
129 VLOG(1) << DebugStringWhole(gdef);
130 auto sess = NewSession();
131 TF_CHECK_OK(sess->Create(gdef));
132 std::vector<Tensor> out;
133 TF_CHECK_OK(sess->Run(
134 {{"dim", test::AsScalar(dim)}, {"x0:0", x0}, {"x1:0", x1}, {"dy:0", dy}},
135 {"dx:0", "dx:1", "dx:2"}, {}, &out));
136 CHECK_EQ(out.size(), 3);
137 TF_CHECK_OK(sess->Close());
138 return out;
139}
140
141std::vector<Tensor> ConcatGradV2(int dim, const Tensor& x0, const Tensor& x1,
142 const Tensor& dy) {

Callers 1

TESTFunction · 0.70

Calls 9

GDefFunction · 0.85
NDefFunction · 0.85
DebugStringWholeFunction · 0.85
NewSessionFunction · 0.70
AsScalarFunction · 0.50
CreateMethod · 0.45
RunMethod · 0.45
sizeMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected