torch.nanquantile¶
- torch.nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None) Tensor¶
這是
torch.quantile()的一個變體,它“忽略”NaN值,計算分位數q時就像input中不存在NaN值一樣。如果某個被縮減的行中的所有值都是NaN,則該縮減的分位數將為NaN。請參閱torch.quantile()的文件。- 引數
- 關鍵字引數
示例
>>> t = torch.tensor([float('nan'), 1, 2]) >>> t.quantile(0.5) tensor(nan) >>> t.nanquantile(0.5) tensor(1.5000) >>> t = torch.tensor([[float('nan'), float('nan')], [1, 2]]) >>> t tensor([[nan, nan], [1., 2.]]) >>> t.nanquantile(0.5, dim=0) tensor([1., 2.]) >>> t.nanquantile(0.5, dim=1) tensor([ nan, 1.5000])