Example #1
0
def test_dtype():

    fname = os.path.join(this_file_dir,
                         'runtime_analysis/{}/general/dtype.txt'.format(DIM))
    if os.path.exists(fname):
        os.remove(fname)
    for lib, call in [
        (l, c) for l, c in helpers.calls
            if c not in [helpers.tf_graph_call, helpers.mx_graph_call]
    ]:

        time_lib = LIB_DICT[lib]

        append_to_file(fname, '{}'.format(lib))

        x0 = ivy_gen.array([random.uniform(0, 1) for _ in range(DIM)], f=lib)

        ivy_gen.dtype(x0, f=lib)
        ivy_gen_w_time.dtype(x0, f=time_lib)
        TIMES_DICT.clear()

        for _ in range(100):

            log_time(fname, 'tb0')
            ivy_gen_w_time.dtype(x0, f=time_lib)
            log_time(fname, 'tb4', time_at_start=True)

            log_time(fname, 'tt0')
            ivy_gen.dtype(x0, f=lib)
            log_time(fname, 'tt1', time_at_start=True)

        write_times()

    append_to_file(fname, 'end of analysis')
Example #2
0
    def dtype(self):
        """
        Return container, with all entries replaced with their data types.

        :return: New datatype container
        """
        return self.map(lambda x, _: _ivy_gen.dtype(x))
Example #3
0
def test_dtype():
    for lib, call in helpers.calls:
        if call is helpers.mx_graph_call:
            # MXNet symbolic does not support dtype
            continue
        assert ivy_gen.dtype(ivy_gen.array([0.], f=lib)) == ivy_gen.array(
            [0.], f=lib).dtype