// Copyright © Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include #include #include #include #include namespace hipdnn_frontend::detail { [[nodiscard]] inline Error unpackConvWgradOperation( hipdnnBackendDescriptor_t opDesc, std::unordered_map>& tensorMap, graph::ConvWgradAttributes& attributes) { // Unpack x tensor std::shared_ptr xTensor; HIPDNN_CHECK_ERROR(unpackAndRegisterTensor(opDesc, HIPDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_X, tensorMap, xTensor, "conv wgrad X tensor")); attributes.set_x(xTensor); // Unpack dy tensor std::shared_ptr dyTensor; HIPDNN_CHECK_ERROR(unpackAndRegisterTensor(opDesc, HIPDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DY, tensorMap, dyTensor, "conv wgrad DY tensor")); attributes.set_dy(dyTensor); // Unpack dw tensor std::shared_ptr dwTensor; HIPDNN_CHECK_ERROR(unpackAndRegisterTensor(opDesc, HIPDNN_ATTR_OPERATION_CONVOLUTION_BWD_FILTER_DW, tensorMap, dwTensor, "conv wgrad DW tensor")); attributes.set_dw(dwTensor); // Unpack shared convolution parameters HIPDNN_CHECK_ERROR(unpackConvolutionParams(opDesc, attributes, "conv wgrad")); // Unpack operation name std::string opName; HIPDNN_CHECK_ERROR( getDescriptorAttrString(opDesc, HIPDNN_ATTR_OPERATION_NAME_EXT, opName, "operation name")); attributes.set_name(opName); return {}; } } // namespace hipdnn_frontend::detail