rgb(image)
rgb (x:torch.Tensor, denorm:Any=None, cl:Any=False, gutter_px:int=3, frame_px:int=1, scale:int=1, view_width:int=966, ax:Optional[matplotlib.axes._axes.Axes]=None)
| Type | Default | Details | |
|---|---|---|---|
| x | Tensor | Tensor to display. [[β¦], C,H,W] or [[β¦], H,W,C] | |
| denorm | Any | None | Reverse per-channel normalization |
| cl | Any | False | Channel-last |
| gutter_px | int | 3 | If more than one tensor -> tile with this gutter width |
| frame_px | int | 1 | If more than one tensor -> tile with this frame width |
| scale | int | 1 | Scale up. Canβt scale down. |
| view_width | int | 966 | target width of the image |
| ax | Optional | None | Use this Axes |
| Returns | RGBProxy |
tensor[2, 3, 196, 196] n=230496 (0.9Mb) xβ[-2.118, 2.640] ΞΌ=-0.388 Ο=1.073

# This image is in the range [0 .. 1] (+/- eps)
tenchman_01 = image * torch.tensor(in_stats[1])[:, None, None] + torch.tensor(in_stats[0])[:, None, None]
# This one is in the range [-1 .. 1] - also somewhat common
tenchman_minus1_1 = tenchman_01 * 2 - 1
rgb(tenchman_minus1_1, denorm='symmetric') # 'symmetric' does the conversion
# Make 8 images with progressively higher brightness and stack them 2x2x2.
eight_images = (torch.stack([image]*8) + torch.linspace(-2, 2, 8)[:,None,None,None])
eight_images = (eight_images
.mul(torch.tensor(in_stats[1])[:,None,None])
.add(torch.tensor(in_stats[0])[:,None,None])
.clamp(0,1)
.view(2,2,2,3,196,196)
)
eight_imagestensor[2, 2, 2, 3, 196, 196] n=921984 (3.5Mb) xβ[0., 1.000] ΞΌ=0.382 Ο=0.319