| 69 | self.assertEqual(bytes(Tensor(data).keccak("shake_128").tolist()), hashlib.shake_128(data).digest(16)) |
| 70 | |
| 71 | def test_variable_bs(self): |
| 72 | data = Tensor([b"abc", b"abc", b"def"], dtype=dtypes.uint8).repeat(2048, 1) |
| 73 | bs = UOp.variable("bs", 1, 4096).bind(3) |
| 74 | out = data.shrink_to(bs, data.shape[-1]).keccak().shrink_to(3, 32) |
| 75 | self.assertEqual(bytes(out[0].tolist()), bytearray.fromhex("3a985da74fe225b2 045c172d6bd390bd 855f086e3e9d525b 46bfe24511431532")) |
| 76 | self.assertEqual(bytes(out[1].tolist()), bytearray.fromhex("3a985da74fe225b2 045c172d6bd390bd 855f086e3e9d525b 46bfe24511431532")) |
| 77 | self.assertEqual(bytes(out[2].tolist()), bytearray.fromhex("8e0d8f672252acb0 ffc5093db8653b18 1513bf9a2097e737 b4f73533dcaf46df")) |
| 78 | |
| 79 | @slow |
| 80 | def test_variable_bs_jit(self): |