Esempio n. 1
0
 def foo(x):
   b = x + get_a_plus_one()
   my_str = string_ops.as_string(b)
   new_str = my_str + "0"
   c = string_ops.string_to_number(new_str, out_type=dtypes.int32)
   logging_ops.print_v2(c)
   b = c + get_a_plus_one()
   return b + 1
Esempio n. 2
0
def SecurePowGrad(op, grad):
    """The gradient for the Secure Pow operator.
    Currently, only y is supported as a constant.
    """
    x = op.inputs[0]
    y = op.inputs[1]
    sx = array_ops.shape(x)
    sy = array_ops.shape(y)
    y_dec = string_ops.as_string(
        gen_math_ops.sub(string_ops.string_to_number(y),
                         constant_op.constant(1.0, dtype=dtypes.float32)))
    # one = constant_op.constant("1")
    # y_dec = SecureSub(y, one, lh_is_const=True, rh_is_const=True)
    temp = SecureMul(y,
                     SecurePow(x, y_dec, lh_is_const=False, rh_is_const=True),
                     lh_is_const=True,
                     rh_is_const=False)
    zero = constant_op.constant("0")
    dX = array_ops.reshape(SecureMul(grad, temp), sx)
    dY = array_ops.reshape(zero, sy)

    return dX, dY
def computation_with_string_ops(x):
    output = string_ops.string_format("1{}", x)
    return string_ops.string_to_number(output)