예제 #1
0
 def body(v, x):
   with ipu.ops.ipu_shard(0):
     z = v + x
   with ipu.ops.ipu_shard(1):
     z = popops_cross_replica_sum.cross_replica_sum(z)
     outfeed = outfeed_queue.enqueue(z)
   return (z, outfeed)
예제 #2
0
 def my_graph():
     with ops.device("/device:IPU:0"):
         with variable_scope.variable_scope("", use_resource=True):
             x = variable_scope.get_variable(
                 "x",
                 dtype=np.float32,
                 shape=[4],
                 initializer=init_ops.constant_initializer(10.0))
         x = x + x
         return [popops_cross_replica_sum.cross_replica_sum(x)]
예제 #3
0
 def my_graph():
     with ops.device("/device:IPU:0"):
         with variable_scope.variable_scope("", use_resource=True):
             x1 = variable_scope.get_variable(
                 "x1",
                 dtype=np.float32,
                 shape=[100],
                 initializer=init_ops.constant_initializer(10.0))
             x2 = variable_scope.get_variable(
                 "x2",
                 dtype=np.int32,
                 shape=[100],
                 initializer=init_ops.constant_initializer(10))
         y1 = popops_cross_replica_sum.cross_replica_sum(x1 + x1)
         z1 = popops_cross_replica_sum.cross_replica_sum(x1 * x1)
         y2 = popops_cross_replica_sum.cross_replica_sum(x2 + x2)
         z2 = popops_cross_replica_sum.cross_replica_sum(x2 * x2)
         return [
             popops_cross_replica_sum.cross_replica_sum(z1 + y1),
             popops_cross_replica_sum.cross_replica_sum(z2 + y2)
         ]
예제 #4
0
        def my_graph(inp):
            with ops.device("/device:IPU:0"):
                x = inp + inp

                return [popops_cross_replica_sum.cross_replica_sum(x)]
예제 #5
0
 def body(v):
     v = popops_cross_replica_sum.cross_replica_sum(v)
     outfeed = outfeed_queue.enqueue(v)
     return (v, outfeed)
예제 #6
0
 def body(v, x):
     v = popops_cross_replica_sum.cross_replica_sum(v + x)
     return v
예제 #7
0
 def body(v, x):
     out = popops_cross_replica_sum.cross_replica_sum(v + x)
     outfeed = outfeed_queue.enqueue({"last": v, "this": out})
     return (out, outfeed)
예제 #8
0
 def body(v, x):
     out = popops_cross_replica_sum.cross_replica_sum(v + x)
     outfeed = outfeed_queue.enqueue((v, out))
     return (out, outfeed)