Back to skills
SKILL.md
Structuralsimilarityindexmeasure
ASecurityCompute the StructuralSimilarityIndexMeasure metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute StructuralSimilarityIndexMeasure, or asks how to score with StructuralSimilarityIndexMeasure.
- 3 stars
- 0 votes
- 0 copies
- 1 view
- Added September 11, 2026
Security analysis
100/100npx -y skills add qhjqhj00/research-skills-pool --skill structuralsimilarityindexmeasure --agent claude-codeAre you the author of Structuralsimilarityindexmeasure?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-structuralsimilarityindexmeasure)---
name: structuralsimilarityindexmeasure
description: Compute the StructuralSimilarityIndexMeasure metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute StructuralSimilarityIndexMeasure, or asks how to score with StructuralSimilarityIndexMeasure.
metadata:
skill_kind: metric
source_lib: torchmetrics
import_path: torchmetrics.StructuralSimilarityIndexMeasure
source: library_introspection
---
# structuralsimilarityindexmeasure
> Metric `StructuralSimilarityIndexMeasure` from `torchmetrics` (torchmetrics.StructuralSimilarityIndexMeasure)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with StructuralSimilarityIndexMeasure, or
mentions `torchmetrics.StructuralSimilarityIndexMeasure` directly, or wants the standard torchmetrics implementation.
## Reference signature
```python
from torchmetrics import StructuralSimilarityIndexMeasure
# _StructuralSimilarityIndexMeasure(gaussian_kernel: bool = True, sigma: Union[float, collections.abc.Sequence[float]] = 1.5, kernel_size: Union[int, collections.abc.Sequence[int]] = 11, reduction: Literal['elementwise_mean', 'sum', 'none', None] = 'elementwise_mean', data_range: Union[float, tuple[float, float], NoneType] = None, k1: float = 0.01, k2: float = 0.03, return_full_image: bool = False, return_contrast_sensitivity: bool = False, **kwargs: Any) -> None
```
## Library docstring
```
Wrapper for deprecated import.
>>> import torch
>>> preds = torch.rand([3, 3, 256, 256])
>>> target = preds * 0.75
>>> ssim = _StructuralSimilarityIndexMeasure(data_range=1.0)
>>> ssim(preds, target)
tensor(0.9219)
```
## Quick recipe
```python
import torchmetrics as _m
score = _m.StructuralSimilarityIndexMeasure(y_true, y_pred)
```
## Don'ts
- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.