MCPcopy Create free account
hub / github.com/conflow-dev/ConFlow / e_matmul

Function e_matmul

operators.py:68–79  ·  view source on GitHub ↗
(x, y)

Source from the content-addressed store, hash-verified

66
67@tf.custom_gradient
68def e_matmul(x, y):
69 z = tf.matmul(x, y)
70 def grad(dz):
71 index = [1,2,0,3,1,4]
72 dx = tf.matmul(dz, tf.transpose(y))
73 real_batch = 32
74 dy = tf.zeros_like(y)
75 for i in index:
76 for j in index:
77 dy += tf.matmul(tf.transpose(x[i * real_batch : (i + 1) * real_batch]),dz[j * real_batch : (j + 1) * real_batch])
78 return dx, dy
79 return z, grad
80
81def create_enclave():
82 sgx_lib = cdll.LoadLibrary(os.path.join(current_path + "/sgx_tf_ops/", "sgx.so"))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected