Functions | |
def | propagate_dtype (outputs, dtype) |
def | add (self, a, b) |
def | mul (self, a, b) |
def | gemm (self, a, b, trans_a=False, trans_b=False) |
def | relu (self, a) |
def | min (self, *args) |
def | max (self, *args) |
def | identity (self, inp) |
def | shape (self, a) |
def | reduce_prod (self, a, axes, keepdims=True) |
def | reshape (self, data, shape) |
def | gather (self, data, indices) |
def | concat (self, inputs, axis=0) |
Variables | |
tuple | shape = (1, 3, 224, 224) |
x0 = gs.Variable(name="x0", dtype=np.float32, shape=shape) | |
x1 = gs.Variable(name="x1", dtype=np.float32, shape=shape) | |
a = gs.Constant("a", values=np.ones(shape=shape, dtype=np.float32)) | |
b = gs.Constant("b", values=np.ones(shape=shape, dtype=np.float32)) | |
mul_out = gs.Variable(name="mul_out") | |
add_out = gs.Variable(name="add_out") | |
Y = gs.Variable(name="Y", dtype=np.float32, shape=shape) | |
list | nodes |
graph = gs.Graph(nodes=nodes, inputs=[x0, x1], outputs=[Y]) | |
The functions registered above greatly simplify the process of building the graph itself. More... | |
input = gs.Variable("input", shape=shape, dtype=np.float32) | |
c = gs.Variable("c") | |
d = gs.Constant("d", values=np.ones(shape=shape, dtype=np.float32)) | |
e = gs.Variable("e") | |
output = gs.Variable("output", shape=shape, dtype=np.float32) | |
x = gs.Variable(name="x", dtype=np.float32, shape=(1, 3, 224, 224)) | |
i0 = gs.Variable(name="i0") | |
i1 = gs.Variable(name="i1") | |
y = gs.Variable(name="y", dtype=np.float32) | |
X = gs.Variable(name="X", shape=(64, 64), dtype=np.float32) | |
inputs | |
A = np.ones(shape=(64, 64), dtype=np.float32) | |
def | axt = graph.gemm(A, X, trans_b=True) |
float | B = np.ones((64, 64), dtype=np.float32) * 0.5 |
def | dense = graph.relu(*graph.add(*axt, B)) |
C = gs.Constant(name="C", values=np.ones(shape=(64, 64), dtype=np.float32)) | |
D = np.ones(shape=(64, 64), dtype=np.float32) | |
outputs | |
dtype | |
MIN_VAL = np.array(0, np.float32) | |
MAX_VAL = np.array(6, np.float32) | |
def | inp = graph.identity(graph.inputs[0]) |
def | max_out = graph.max(graph.min(inp, MAX_VAL), MIN_VAL) |
float32 | |
name | |
def | input_shape = graph.shape(graph.inputs[0]) |
def | volume = graph.reduce_prod(input_shape, axes=[0]) |
def | flattened = graph.reshape(graph.inputs[0], volume) |
def | NC = graph.gather(input_shape, indices=[0, 1]) |
def | HW = graph.gather(input_shape, indices=[2, 3]) |
def | new_shape = graph.concat([NC, graph.reduce_prod(HW, axes=[0])]) |
def | partially_flattened = graph.reshape(graph.inputs[0], new_shape) |
def generate.propagate_dtype | ( | outputs, | |
dtype | |||
) |
def generate.add | ( | self, | |
a, | |||
b | |||
) |
def generate.mul | ( | self, | |
a, | |||
b | |||
) |
def generate.gemm | ( | self, | |
a, | |||
b, | |||
trans_a = False , |
|||
trans_b = False |
|||
) |
def generate.relu | ( | self, | |
a | |||
) |
def generate.min | ( | self, | |
* | args | ||
) |
def generate.max | ( | self, | |
* | args | ||
) |
def generate.identity | ( | self, | |
inp | |||
) |
def generate.shape | ( | self, | |
a | |||
) |
def generate.reduce_prod | ( | self, | |
a, | |||
axes, | |||
keepdims = True |
|||
) |
def generate.reshape | ( | self, | |
data, | |||
shape | |||
) |
def generate.gather | ( | self, | |
data, | |||
indices | |||
) |
def generate.concat | ( | self, | |
inputs, | |||
axis = 0 |
|||
) |
tuple generate.shape = (1, 3, 224, 224) |
generate.mul_out = gs.Variable(name="mul_out") |
generate.add_out = gs.Variable(name="add_out") |
list generate.nodes |
The functions registered above greatly simplify the process of building the graph itself.
generate.c = gs.Variable("c") |
generate.e = gs.Variable("e") |
generate.i0 = gs.Variable(name="i0") |
generate.i1 = gs.Variable(name="i1") |
generate.y = gs.Variable(name="y", dtype=np.float32) |
generate.inputs |
float generate.B = np.ones((64, 64), dtype=np.float32) * 0.5 |
generate.outputs |
generate.dtype |
generate.MIN_VAL = np.array(0, np.float32) |
generate.MAX_VAL = np.array(6, np.float32) |
def generate.inp = graph.identity(graph.inputs[0]) |
generate.float32 |
generate.name |
def generate.input_shape = graph.shape(graph.inputs[0]) |
def generate.volume = graph.reduce_prod(input_shape, axes=[0]) |
def generate.flattened = graph.reshape(graph.inputs[0], volume) |
def generate.NC = graph.gather(input_shape, indices=[0, 1]) |
def generate.HW = graph.gather(input_shape, indices=[2, 3]) |
def generate.partially_flattened = graph.reshape(graph.inputs[0], new_shape) |