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

Function MirrorPadKnown

tensorflow/core/ops/array_ops.cc:2188–2203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2186namespace {
2187template <typename T>
2188Status MirrorPadKnown(InferenceContext* c, ShapeHandle input,
2189 const Tensor* paddings_t, int64 input_rank) {
2190 auto paddings_data = paddings_t->matrix<T>();
2191 std::vector<DimensionHandle> dims(input_rank);
2192 for (int64 i = 0; i < input_rank; ++i) {
2193 const int64 pad0 = static_cast<int64>(paddings_data(i, 0));
2194 const int64 pad1 = static_cast<int64>(paddings_data(i, 1));
2195 if (pad0 < 0 || pad1 < 0) {
2196 return errors::InvalidArgument("Paddings must be non-negative");
2197 }
2198
2199 TF_RETURN_IF_ERROR(c->Subtract(c->Dim(input, i), pad0 + pad1, &dims[i]));
2200 }
2201 c->set_output(0, c->MakeShape(dims));
2202 return Status::OK();
2203}
2204
2205} // namespace
2206

Callers

nothing calls this directly

Calls 5

InvalidArgumentFunction · 0.85
SubtractMethod · 0.80
DimMethod · 0.45
set_outputMethod · 0.45
MakeShapeMethod · 0.45

Tested by

no test coverage detected