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

Method GetStride

tensorflow/compiler/tf2xla/kernels/pooling_ops.cc:100–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 }
99
100 xla::StatusOr<std::vector<int64>> GetStride(XlaOpKernelContext* ctx) {
101 if (ctx->num_inputs() == 1) {
102 return stride_;
103 }
104 const TensorShape stride_shape = ctx->InputShape(2);
105 // Validate input sizes.
106 if (!TensorShapeUtils::IsVector(stride_shape)) {
107 return errors::InvalidArgument("stride must be a vector, not shape ",
108 stride_shape.DebugString());
109 }
110 if (stride_shape.num_elements() != num_dims()) {
111 return errors::InvalidArgument(
112 "Sliding window stride field must "
113 "specify ",
114 num_dims(), " dimensions");
115 }
116 std::vector<int64> stride;
117 auto status = ctx->ConstantInputAsIntVector(2, &stride);
118 if (!status.ok()) {
119 return status;
120 }
121 return stride;
122 }
123
124 protected:
125 const int num_spatial_dims_;

Callers

nothing calls this directly

Calls 7

InvalidArgumentFunction · 0.85
InputShapeMethod · 0.80
num_inputsMethod · 0.45
DebugStringMethod · 0.45
num_elementsMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected