{"record":{"id":"145c104e0074258e","repo":"tracel-ai/burn","slug":"other-reduction-is-not-supported-145c10","errorCode":null,"errorMessage":"{other:?} reduction is not supported","messagePattern":"(.+?) reduction is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-vision/src/loss/gram_matrix/gram_matrix_loss.rs","lineNumber":174,"sourceCode":"    ///\n    /// let predictions = /* [N, 3, H, W] */;\n    /// let targets = /* [N, 3, H, W] */;\n    ///\n    /// # Returns a tensor with shape [1] containing a single loss value\n    /// let loss = loss_fn.forward(predictions, targets, Reduction::Mean);\n    /// ```\n    pub fn forward(\n        &self,\n        predictions: Tensor<4>,\n        targets: Tensor<4>,\n        reduction: Reduction,\n    ) -> Tensor<1> {\n        let unreduced_loss = self.forward_no_reduction(predictions, targets);\n\n        match reduction {\n            Reduction::Mean | Reduction::Auto => unreduced_loss.mean(),\n            Reduction::Sum => unreduced_loss.sum(),\n            other => panic!(\"{other:?} reduction is not supported\"),\n        }\n    }\n\n    /// Computes the unreduced Gram Matrix Loss per sample in the batch.\n    ///\n    /// # Arguments\n    ///\n    /// - `predictions` - The model's predicted images. The pixels should be in the \\[0.0, 1.0\\] range.\n    /// - `targets` - The ground truth target images. The pixels should be in the \\[0.0, 1.0\\] range.\n    ///\n    /// # Returns\n    ///\n    /// A 1D tensor containing the total weighted loss for each sample in the batch.\n    ///\n    /// # Shapes\n    ///\n    /// - predictions: `[batch_size, 3, height, width]`\n    /// - targets: `[batch_size, 3, height, width]`","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-vision/src/loss/gram_matrix/gram_matrix_loss.rs#L156-L192","documentation":"Exhaustive-match guard in `GramMatrixLoss::forward`: only Mean/Auto and Sum reductions are implemented for the gram matrix loss; any other `Reduction` variant (e.g., a per-element or weighted reduction) reaches the wildcard arm and panics.","triggerScenarios":"Thrown at crates/burn-vision/src/loss/gram_matrix/gram_matrix_loss.rs:174 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use `Reduction::Mean` or `Reduction::Sum` when calling forward","Apply the desired custom reduction manually on `forward_no_reduction` output","Extend the match in gram_matrix_loss.rs if a new reduction is required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}