assignment-a1: adds add_matrix_vector and avg_color
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import torch
|
||||
from PIL import Image
|
||||
from torchvision.transforms import ToTensor
|
||||
|
||||
|
||||
def avg_color(img: torch.Tensor):
|
||||
raise NotImplementedError()
|
||||
result = img.mean(dim=(1, 2)).tolist()
|
||||
return tuple(result)
|
||||
|
||||
|
||||
def mask(foreground: torch.Tensor, background: torch.Tensor, mask_tensor: torch.Tensor, threshold: float):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def add_matrix_vector(matrix: torch.Tensor, vector: torch.Tensor):
|
||||
raise NotImplementedError()
|
||||
return matrix.add(vector)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user