代码:
python
import torch
import os
import pandas as pd
import numpy as np
x = torch.tensor([[1, 2, 3], [4, 5, 6]])
print(x)
sumA = x.sum(dim = 0)
print(sumA)
print(torch.sum(x, dim = 0, keepdim= True))
print(x/torch.sum(x, dim = 0, keepdim= True) )