MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / GetNearestInputIndex

Function GetNearestInputIndex

oneflow/user/kernels/upsample_kernel.h:29–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29OF_DEVICE_FUNC static int64_t GetNearestInputIndex(const int64_t out_dim_idx, const double scale,
30 const int64_t in_dim_size) {
31 int64_t index = static_cast<int64_t>(floorf(out_dim_idx * scale));
32 index = index > in_dim_size - 1 ? in_dim_size - 1 : index;
33 return index;
34}
35
36OF_DEVICE_FUNC double GetAreaPixelScale(const int64_t input_size, const int64_t output_size,
37 bool align_corners, const double scale) {

Callers 6

UpsampleNearest1DForwardFunction · 0.85
UpsampleNearest2DForwardFunction · 0.85
UpsampleNearest3DForwardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected