import xnode_old

myInt = 69
myInt2 = 96
xnode_old.show(myInt, myInt2)
Exemplo n.º 2
0
import xnode_old
from typing import List


def digits_to_number(digits: List[int]) -> int:
    return int("".join(str(d) for d in digits))


def largest_num(list: List[int]) -> int:
    return 0


if __name__ == "__main__":
    # Run tests
    xnode_old.show(digits_to_number([1, 2, 3, 0]))
    xnode_old.show(digits_to_number([0, 1, 2, 3]))
Exemplo n.º 3
0
import xnode_old

myInt = 69
xnode_old.show(myInt)
Exemplo n.º 4
0
    def __call__(self, in1):
        return in1 + self.state


def parent_fn(in1):
    x = child_fn(in1)
    x = child_fn(x)
    x = child_fn(x)
    return x


def grandparent_fn(in1, in2):
    out1 = parent_fn(in1)
    out2 = parent_fn(in2)
    return out1 + out2


# TODO: make these annotations
child_fn = track_callable_instance(ChildFn())
# # TODO: item alignment?
parent_fn = track_callable_instance(parent_fn)
grandparent_fn = track_callable_instance(grandparent_fn)

# TODO: handle args to containers -- ignore?
x = grandparent_fn(0, 1)
graph = x.xn().compile_full()[0]
# print(graph)

xnode_old.show(x)
Exemplo n.º 5
0
import xnode_old
import random
import string

length = 5
strings = 30

strings = [
    ''.join(random.choice(string.ascii_lowercase) for _ in range(length))
    for _ in range(strings)
]
xnode_old.show(strings)
tree = dict()
for s in strings:
    t = tree
    for c in s:
        if c not in t:
            t[c] = dict()
        t = t[c]

    xnode_old.show(tree)
Exemplo n.º 6
0
import xnode_old

urls = [
    'https://www.google.com/hello/world',
    'https://www.google.com/goodbye/world',
    'https://www.google.com/goodbye/moon'
]
xnode_old.show(urls)
params = [url.split('/')[3:] for url in urls]
xnode_old.show(params)
pairs = set()
for i, param_list in enumerate(params):
    xnode_old.show(param_list)
    for t, other_param_list in enumerate(params[i + 1:]):
        xnode_old.show(other_param_list)
        differences = 0
        for param1, param2 in zip(param_list, other_param_list):
            if param1 != param2:
                differences += 1
                if differences > 1:
                    break
        xnode_old.show(differences)
        if differences == 1:
            pairs.add((urls[i], urls[t]))
xnode_old.show(pairs)
Exemplo n.º 7
0
import torch
import xnode_old
from xntorch.autograd import Variable
import sys
import os
sys.path.append(os.path.join(sys.path[0], '..', 'test'))
from stack_lstm import StackLSTM, PseudoLogLSTM
from vgg import vgg16

myInt = 86
myInt2 = 87
myFloat = 3.1415926535897
xnode_old.show(myFloat)
myBool = True
myString = "The quick brown fox jumps over the lazy dog"
xnode_old.show(myString)
myNone = None

myList = [1, 2.3, False, "hello", None, [10, 11, ["This", "is", "the", "end"]]]
xnode_old.show(myList)
myList[0] = 100
myDict = {"key1": "value1", "key2": "value2", 10: myList}
myTensor1 = torch.rand(2, 3, 4, 5)
myTensor2 = myTensor1[0, 0]
myTensor3 = myTensor1[0, 0, 0]
myFloat2 = myTensor1[0, 0, 0, 0]
xnode_old.show(myTensor1)

myClass = Variable
myVGGInput = Variable(torch.ones(1, 3, 32, 32))
myVGG = vgg16()
Exemplo n.º 8
0
import xnode_old

xnode_old.show(86)
import xnode_old

xnode_old.show()