コード例 #1
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
    def test_sparse_getitem_two_dim_int_slice(self):
        actual = self.dense[:, 1]
        res = sparse_getitem(self.sparse, (slice(None, None, None), 1))
        self.assertTrue(torch.equal(actual, res.to_dense()))

        actual = self.dense[1, :]
        res = sparse_getitem(self.sparse, (1, slice(None, None, None)))
        self.assertTrue(torch.equal(actual, res.to_dense()))
コード例 #2
0
def test_sparse_getitem_two_dim_int_slice():
    actual = dense[:, 1]
    res = sparse_getitem(sparse, (slice(None, None, None), 1))
    assert torch.equal(actual, res.to_dense())

    actual = dense[1, :]
    res = sparse_getitem(sparse, (1, slice(None, None, None)))
    assert torch.equal(actual, res.to_dense())
コード例 #3
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
    def test_sparse_repeat_1d(self):
        sparse_1d = sparse_getitem(self.sparse, 1)
        actual = sparse_1d.to_dense().repeat(3, 1)
        res = sparse_repeat(sparse_1d, 3, 1)
        self.assertTrue(torch.equal(actual, res.to_dense()))

        actual = sparse_1d.to_dense().repeat(2, 3)
        res = sparse_repeat(sparse_1d, 2, 3)
        self.assertTrue(torch.equal(actual, res.to_dense()))
コード例 #4
0
def test_sparse_repeat_1d():
    sparse_1d = sparse_getitem(sparse, 1)
    actual = sparse_1d.to_dense().repeat(3, 1)
    res = sparse_repeat(sparse_1d, 3, 1)
    assert torch.equal(actual, res.to_dense())

    actual = sparse_1d.to_dense().repeat(2, 3)
    res = sparse_repeat(sparse_1d, 2, 3)
    assert torch.equal(actual, res.to_dense())
コード例 #5
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
 def test_sparse_getitem_two_dim_slice(self):
     actual = self.dense[2:4, 1:3]
     res = sparse_getitem(self.sparse, (slice(2, 4), slice(1, 3)))
     self.assertTrue(torch.equal(actual, res.to_dense()))
コード例 #6
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
 def test_sparse_getitem_two_dim_int(self):
     actual = self.dense[2, 1]
     res = sparse_getitem(self.sparse, (2, 1))
     self.assertEqual(actual, res)
コード例 #7
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
 def test_sparse_getitem_one_dim_slice(self):
     actual = self.dense[2:4]
     res = sparse_getitem(self.sparse, slice(2, 4))
     self.assertTrue(torch.equal(actual, res.to_dense()))
コード例 #8
0
ファイル: test_sparse.py プロジェクト: yohanJung/gpytorch
 def test_sparse_getitem_one_dim_int(self):
     actual = self.dense[3]
     res = sparse_getitem(self.sparse, 3)
     self.assertTrue(torch.equal(actual, res.to_dense()))
コード例 #9
0
def test_sparse_getitem_two_dim_slice():
    actual = dense[2:4, 1:3]
    res = sparse_getitem(sparse, (slice(2, 4), slice(1, 3)))
    assert torch.equal(actual, res.to_dense())
コード例 #10
0
def test_sparse_getitem_two_dim_int():
    actual = dense[2, 1]
    res = sparse_getitem(sparse, (2, 1))
    assert actual == res
コード例 #11
0
def test_sparse_getitem_one_dim_slice():
    actual = dense[2:4]
    res = sparse_getitem(sparse, slice(2, 4))
    assert torch.equal(actual, res.to_dense())
コード例 #12
0
def test_sparse_getitem_one_dim_int():
    actual = dense[3]
    res = sparse_getitem(sparse, 3)
    assert torch.equal(actual, res.to_dense())