Sha256: d35d3cdc213a5094917b8bc491ca3ddf97f817123c38b721911749c0041aa5de
Contents?: true
Size: 622 Bytes
Versions: 9
Compression:
Stored size: 622 Bytes
Contents
TensorStream::OpMaker.define_operation :mod do |op| op.what_it_does "Returns element-wise remainder of division." op.parameter :input_a, "tensor X" op.parameter :input_b, "tensor Y" op.apply_data_type_coercion! op.supports_broadcasting! op.option :name, "Optional name", :nil op.define_gradient do |grad, node, params| x, y = params sx = ts.shape(x) sy = ts.shape(y) rx, ry = _broadcast_gradient_args(sx, sy) floor_xy = ts.floor_div(x, y) gx = ts.reshape(ts.reduce_sum(grad, rx), sx) gy = ts.reshape(ts.reduce_sum(grad * ts.negative(floor_xy), ry), sy) [gx, gy] end end
Version data entries
9 entries across 9 versions & 1 rubygems