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

Function ConcatGradV2

tensorflow/core/ops/array_grad_test.cc:141–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141std::vector<Tensor> ConcatGradV2(int dim, const Tensor& x0, const Tensor& x1,
142 const Tensor& dy) {
143 auto T = DT_FLOAT;
144 auto gdef = test::function::GDef(
145 {f::NDef("x0", "Placeholder", {}, {{"dtype", T}}),
146 f::NDef("x1", "Placeholder", {}, {{"dtype", T}}),
147 f::NDef("dim", "Placeholder", {}, {{"dtype", DT_INT32}}),
148 f::NDef("dy", "Placeholder", {}, {{"dtype", T}}),
149 f::NDef("dx", "SymbolicGradient", {"x0", "x1", "dim", "dy"},
150 {{"f", FDH::FunctionRef("ConcatV2", {{"N", 2}, {"T", T}})},
151 {"Tin", DataTypeSlice{T, T, DT_INT32, T}},
152 {"Tout", DataTypeSlice{T, T, DT_INT32}}})});
153 VLOG(1) << DebugStringWhole(gdef);
154 auto sess = NewSession();
155 TF_CHECK_OK(sess->Create(gdef));
156 std::vector<Tensor> out;
157 TF_CHECK_OK(sess->Run(
158 {{"x0:0", x0}, {"x1:0", x1}, {"dim", test::AsScalar(dim)}, {"dy:0", dy}},
159 {"dx:0", "dx:1", "dx:2"}, {}, &out));
160 CHECK_EQ(out.size(), 3);
161 TF_CHECK_OK(sess->Close());
162 return out;
163}
164
165TEST(ArrayGradTest, ConcatGrad) {
166 Tensor x0(DT_FLOAT, {2, 3, 5});

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