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

Method Compute

tensorflow/core/kernels/conv_ops_fused_impl.h:931–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929 }
930
931 void Compute(OpKernelContext* context) override {
932 // Input tensor is of the following dimensions:
933 // [ batch, in_rows, in_cols, in_depth ]
934 const Tensor& input = context->input(0);
935
936 // Input filter is of the following dimensions:
937 // [ filter_rows, filter_cols, in_depth, out_depth]
938 const Tensor& filter = context->input(1);
939
940 Conv2DDimensions dimensions;
941 OP_REQUIRES_OK(context,
942 ComputeConv2DDimension(params_, input, filter, &dimensions));
943
944 TensorShape out_shape = ShapeFromFormat(
945 params_.data_format, dimensions.batch, dimensions.out_rows,
946 dimensions.out_cols, dimensions.out_depth);
947
948 // Output tensor is of the following dimensions:
949 // [ in_batch, out_rows, out_cols, out_depth ]
950 Tensor* output = nullptr;
951 OP_REQUIRES_OK(context, context->allocate_output(0, out_shape, &output));
952
953 VLOG(2) << "FusedConv2D: in_depth = " << dimensions.in_depth
954 << ", patch_depth = " << dimensions.patch_depth
955 << ", input_cols = " << dimensions.input_cols
956 << ", filter_cols = " << dimensions.filter_cols
957 << ", input_rows = " << dimensions.input_rows
958 << ", filter_rows = " << dimensions.filter_rows
959 << ", stride_rows = " << dimensions.stride_rows
960 << ", stride_cols = " << dimensions.stride_cols
961 << ", dilation_rows = " << dimensions.dilation_rows
962 << ", dilation_cols = " << dimensions.dilation_cols
963 << ", out_depth = " << dimensions.out_depth;
964
965 // If there is nothing to compute, return.
966 if (out_shape.num_elements() == 0) {
967 return;
968 }
969
970 LaunchFusedConv2DOp<Device, T>()(context, use_cudnn_, cudnn_use_autotune_,
971 input, filter, fused_computation_,
972 fused_computation_args_, params_,
973 dimensions, output);
974 }
975
976 private:
977 Conv2DParameters params_;

Callers

nothing calls this directly

Calls 5

ComputeConv2DDimensionFunction · 0.85
ShapeFromFormatFunction · 0.85
allocate_outputMethod · 0.80
inputMethod · 0.45
num_elementsMethod · 0.45

Tested by

no test coverage detected