Skip to content

Commit

Permalink
fix the second python example
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Lopuhin <kostia.lopuhin@gmail.com>
  • Loading branch information
lopuhin committed Oct 22, 2021
1 parent a20aaac commit bb91389
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions docs/overview/python-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ Similarly you can find the same extended example as above:
mgr = Manager(0, [2])
# Can be initialized with List[] or np.Array
tensor_in_a = Tensor([2, 2, 2])
tensor_in_b = Tensor([1, 2, 3])
tensor_out = Tensor([0, 0, 0])
tensor_in_a = mgr.tensor([2, 2, 2])
tensor_in_b = mgr.tensor([1, 2, 3])
tensor_out = mgr.tensor([0, 0, 0])
mgr.eval_tensor_create_def([tensor_in_a, tensor_in_b, tensor_out])
seq = mgr.create_sequence("op")
seq = mgr.sequence()
seq.eval(kp.OpTensorSyncDevice([tensor_in_a, tensor_in_b, tensor_out]))
# Define the function via PyShader or directly as glsl string or spirv bytes
@python2shader
Expand All @@ -81,8 +80,8 @@ Similarly you can find the same extended example as above:
algo = mgr.algorithm([tensor_in_a, tensor_in_b, tensor_out], compute_shader_multiply.to_spirv())
# Run shader operation asynchronously and then await
mgr.eval_async(kp.OpAlgoDispatch(algo)))
mgr.eval_await()
seq.eval_async(kp.OpAlgoDispatch(algo))
seq.eval_await()
seq.record(kp.OpTensorSyncLocal([tensor_in_a]))
seq.record(kp.OpTensorSyncLocal([tensor_in_b]))
Expand Down

0 comments on commit bb91389

Please sign in to comment.