Python tensorflow 模块,tan() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用tensorflow.tan()

项目:complex_tf    作者:woodshop    | 项目源码 | 文件源码
def testCplxTanGPU(self):
        shapes = [(5,4,3), (5,4), (5,), (1,)]
        for sh in shapes:
            x = ((np.random.randn(*sh) +
                  1j*np.random.randn(*sh)).astype(np.complex64))
            self._compareGpu(x, np.tan, tf.tan)
项目:complex_tf    作者:woodshop    | 项目源码 | 文件源码
def testCplxTanGradGPU(self):
        shapes = [(5,4,3), (5,4), (5,), (1,)]
        for sh in shapes:
            x = ((np.random.randn(*sh) +
                  1j*np.random.randn(*sh)).astype(np.complex64))
            self._compareGpuGrad(x, np.tan, tf.tan)
项目:lsdc    作者:febert    | 项目源码 | 文件源码
def setUp(self):
    super(CoreUnaryOpsTest, self).setUp()

    self.ops = [
        ('abs', operator.abs, tf.abs, core.abs_function),
        ('neg', operator.neg, tf.neg, core.neg),
        # TODO(shoyer): add unary + to core TensorFlow
        ('pos', None, None, None),
        ('sign', None, tf.sign, core.sign),
        ('reciprocal', None, tf.reciprocal, core.reciprocal),
        ('square', None, tf.square, core.square),
        ('round', None, tf.round, core.round_function),
        ('sqrt', None, tf.sqrt, core.sqrt),
        ('rsqrt', None, tf.rsqrt, core.rsqrt),
        ('log', None, tf.log, core.log),
        ('exp', None, tf.exp, core.exp),
        ('log', None, tf.log, core.log),
        ('ceil', None, tf.ceil, core.ceil),
        ('floor', None, tf.floor, core.floor),
        ('cos', None, tf.cos, core.cos),
        ('sin', None, tf.sin, core.sin),
        ('tan', None, tf.tan, core.tan),
        ('acos', None, tf.acos, core.acos),
        ('asin', None, tf.asin, core.asin),
        ('atan', None, tf.atan, core.atan),
        ('lgamma', None, tf.lgamma, core.lgamma),
        ('digamma', None, tf.digamma, core.digamma),
        ('erf', None, tf.erf, core.erf),
        ('erfc', None, tf.erfc, core.erfc),
        ('lgamma', None, tf.lgamma, core.lgamma),
    ]
    total_size = np.prod([v.size for v in self.original_lt.axes.values()])
    self.test_lt = core.LabeledTensor(
        tf.cast(self.original_lt, tf.float32) / total_size,
        self.original_lt.axes)
项目:monodepth360    作者:srijanparmeshwar    | 项目源码 | 文件源码
def attenuate_rectilinear(self, K, disparity, position):
        S, T = lat_long_grid([tf.shape(disparity)[1], tf.shape(disparity)[2]])
        _, T_grids = self.expand_grids(S, -T, tf.shape(disparity)[0])
        if position == "top":
            attenuated_disparity = (1.0 / np.pi) * (tf.atan(disparity / K[1] + tf.tan(T_grids)) - T_grids)
        else:
            attenuated_disparity = (1.0 / np.pi) * (T_grids - tf.atan(tf.tan(T_grids) - disparity / K[1]))
        return tf.clip_by_value(tf.where(tf.is_finite(attenuated_disparity), attenuated_disparity, tf.zeros_like(attenuated_disparity)), 1e-6, 0.75)
项目:monodepth360    作者:srijanparmeshwar    | 项目源码 | 文件源码
def attenuate_equirectangular(self, disparity, position):
        S, T = lat_long_grid([tf.shape(disparity)[1], tf.shape(disparity)[2]])
        _, T_grids = self.expand_grids(S, -T, tf.shape(disparity)[0])
        if position == "top":
            attenuated_disparity = (1.0 / np.pi) * (tf.atan(tf.tan(np.pi * disparity) + tf.tan(T_grids)) - T_grids)
        else:
            attenuated_disparity = (1.0 / np.pi) * (T_grids - tf.atan(tf.tan(T_grids) - tf.tan(np.pi * disparity)))
        return tf.clip_by_value(tf.where(tf.is_finite(attenuated_disparity), attenuated_disparity, tf.zeros_like(attenuated_disparity)), 1e-6, 0.75)
项目:monodepth360    作者:srijanparmeshwar    | 项目源码 | 文件源码
def disparity_to_depth(self, disparity, position, epsilon = 1e-6):
        baseline_distance = self.params.baseline
        S, T = lat_long_grid([tf.shape(disparity)[1], tf.shape(disparity)[2]])
        _, T_grids = self.expand_grids(S, -T, tf.shape(disparity)[0])
        if position == "top":
            t1 = tf.tan(T_grids)
            t2 = tf.tan(T_grids + np.pi * disparity)
        else:
            t1 = tf.tan(T_grids)
            t2 = tf.tan(T_grids - np.pi * disparity)
        return baseline_distance / (tf.abs(t2 - t1) + epsilon)
项目:monodepth360    作者:srijanparmeshwar    | 项目源码 | 文件源码
def depth_to_disparity(self, depth, position):
        baseline_distance = self.params.baseline
        S, T = lat_long_grid([tf.shape(depth)[1], tf.shape(depth)[2]])
        _, T_grids = self.expand_grids(S, T, tf.shape(depth)[0])
        if position == "top":
            return self.disparity_scale * (np.pi / 2.0 - atan2(baseline_distance * depth, (1.0 + tf.tan(-T_grids) ** 2.0) * (depth ** 2.0) + baseline_distance * depth * tf.tan(-T_grids)))
        else:
            return self.disparity_scale * (atan2(baseline_distance * depth, (1.0 + tf.tan(-T_grids) ** 2.0) * (depth ** 2.0) - baseline_distance * depth * tf.tan(-T_grids)) - np.pi / 2.0)
项目:monodepth360    作者:srijanparmeshwar    | 项目源码 | 文件源码
def backproject(S, T, depth):
    # Convert to Cartesian for modified depth input.
    # depth = sqrt(x^2 + z^2).
    x = depth * tf.sin(S)
    y = depth * tf.tan(T)
    z = depth * tf.cos(S)
    return x, y, z
项目:tfdeploy    作者:riga    | 项目源码 | 文件源码
def test_Tan(self):
        t = tf.tan(self.random(4, 3))
        self.check(t)