mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/159252 Approved by: https://github.com/Skylion007
50 lines
920 B
Plaintext
50 lines
920 B
Plaintext
# Basic tests
|
|
import tempfile
|
|
from torch.utils._ordered_set import OrderedSet
|
|
|
|
|
|
print(f"{tempfile.gettempdir()}/memory_snapshot.pickle")
|
|
|
|
ignored = set() # noqa: set_linter
|
|
a = OrderedSet()
|
|
b = "set()"
|
|
c = OrderedSet
|
|
d = c.set
|
|
f = (
|
|
OrderedSet(
|
|
)
|
|
)
|
|
ignored = (
|
|
set( # noqa: set_linter
|
|
)
|
|
)
|
|
|
|
# Non-sets
|
|
|
|
d = {}
|
|
long_string = """ set()
|
|
set() set x.set set()
|
|
\""""
|
|
|
|
class A:
|
|
def set(self, x):
|
|
self.x = x
|
|
|
|
set = A().set
|
|
|
|
# An f string as in https://github.com/pytorch/pytorch/issues/159056
|
|
f_string = f" {h:{w}} "
|
|
|
|
# Braced sets
|
|
|
|
set1 = OrderedSet([1])
|
|
set2 = OrderedSet([1, 2])
|
|
|
|
iterator_set = OrderedSet([i for i in range(10)])
|
|
|
|
# A dict with two sets.
|
|
dict_set = {"a": OrderedSet([2, 3]), "b": OrderedSet([i for i in range(3)])}
|
|
|
|
# A set containing an object constructed with a dict and a set
|
|
sos_set = OrderedSet([Something({i: i + 1 for i in range(3)}, OrderedSet([i + 1 for i in range(3)]))])
|