File size: 5,764 Bytes
2d13eb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
[
    {
      "function_name": "__call__",
      "file_path": "unf_core.py",
      "function_calls": [
        {
          "function_call_name": "tree_flatten",
          "functionality": "Flattens a JAX pytree into a list of leaves and a treedef.",
          "input": "jtu.tree_map(LeafTuple, params, perm_spec)",
          "output": "Tuple containing list of leaves and treedef.",
          "location_or_namespace": "jax.tree_util"
        },
        {
          "function_call_name": "tree_map",
          "functionality": "Applies a function element-wise to the leaves of one or more pytrees.",
          "input": "LeafTuple, params, perm_spec",
          "output": "A pytree with LeafTuple instances at the leaves.",
          "location_or_namespace": "jax.tree_util"
        },
        {
          "function_call_name": "LeafTuple",
          "functionality": "Helper function/class to pair a parameter tensor with its permutation specification.",
          "input": "Individual parameter leaf, individual permutation specification leaf.",
          "output": "A tuple (parameter_leaf, spec_leaf).",
          "location_or_namespace": "algorithm.py"
        },
        {
          "function_call_name": "partial",
          "functionality": "Returns a new partial object which when called will behave like func called with the positional arguments args and keyword arguments keywords.",
          "input": "gen_basis, out_spec, in_spec, out_param.shape",
          "output": "A new partial function object.",
          "location_or_namespace": "functools"
        },
        {
          "function_call_name": "gen_basis",
          "functionality": "Implements Algorithm 1 from the paper to generate basis functions for the equivariant map between two tensors with given permutation specifications.",
          "input": "out_spec (tuple of int), in_spec (tuple of int), out_param.shape (tuple of int)",
          "output": "A representation that allows computation of basis functions (e.g., a function or list of functions).",
          "location_or_namespace": "algorithm.py"
        },
        {
          "function_call_name": "vmap",
          "functionality": "Vectorizes a function over specified axes.",
          "input": "functools.partial(gen_basis, out_spec, in_spec, out_param.shape), in_axes=-1, out_axes=-1",
          "output": "A vectorized function.",
          "location_or_namespace": "jax"
        },
        {
          "function_call_name": "vmapped_gen_basis",
          "functionality": "Applies the vectorized basis generation function to the input parameter tensor.",
          "input": "in_param (JAX tensor)",
          "output": "Tensor representing the basis terms for the (i, j) pair, potentially batched over input channels.",
          "location_or_namespace": "algorithm.py (via jax.vmap)"
        },
        {
          "function_call_name": "param",
          "functionality": "Registers and retrieves a learnable parameter within the Flax module.",
          "input": "Name (string), Initializer function, Shape (tuple of int). E.g., f\"theta_{i}\", build_init_fn(scale, shape), shape.",
          "output": "A JAX parameter tensor.",
          "location_or_namespace": "flax.linen.Module"
        },
        {
          "function_call_name": "build_init_fn",
          "functionality": "Helper function defined in the module to create a scaled random normal initialization function.",
          "input": "scale (float), shape (tuple of int)",
          "output": "An initialization function (lambda).",
          "location_or_namespace": "unf_core.py"
        },
        {
          "function_call_name": "sqrt",
          "functionality": "Calculates the square root of a number.",
          "input": "1 / fan_in",
          "output": "The square root (float).",
          "location_or_namespace": "math"
        },
        {
          "function_call_name": "zeros_init",
          "functionality": "Provides a Flax initializer that sets parameters to zero.",
          "input": "None",
          "output": "An initialization function.",
          "location_or_namespace": "flax.linen.initializers"
        },
        {
          "function_call_name": "tree_unflatten",
          "functionality": "Unflattens a list of leaves back into a pytree structure using a treedef.",
          "input": "tree_def (JAX treedef), outs (List of JAX tensors)",
          "output": "A JAX pytree with the same structure as the original input 'params'.",
          "location_or_namespace": "jax.tree_util"
        }
      ]
    },
    {
      "function_name": "__call__",
      "file_path": "unf_core.py",
      "function_calls": [
        {
          "function_call_name": "isinstance",
          "functionality": "Checks if an object is an instance of a class or a tuple of classes.",
          "input": "layer, (UNFLayer, type(BatchUNFLayer))",
          "output": "Boolean (True or False).",
          "location_or_namespace": "builtins"
        },
        {
          "function_call_name": "type",
          "functionality": "Returns the type of an object.",
          "input": "BatchUNFLayer",
          "output": "The type object for BatchUNFLayer.",
          "location_or_namespace": "builtins"
        },
         {
          "function_call_name": "layer.__call__",
          "functionality": "Applies the transformation defined by the specific layer instance. This is a dynamic call.",
          "input": "Depends on layer type: (out, spec) for UNFLayer/BatchUNFLayer, (out) for others like nf_relu.",
          "output": "Transformed parameters (pytree).",
          "location_or_namespace": "Internal (either UNFLayer, BatchUNFLayer, or other layer type's definition in this or related files)."
        }
      ]
    }
  ]