PyTorch——Tensor_把索引標籤轉換成one-hot標籤表示

對於分類問題,標籤能夠是類別索引值也能夠是one-hot表示。以10類別分類爲例,lable=[3] 和label=[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]是一致的.python 如今給定索引標籤,怎麼將其轉換爲one-hot標籤表示?web >>>class_num = 10 >>>batch_size = 4 >>>label = torch.LongTensor(batc
相關文章
相關標籤/搜索