def run(self, feed_dict, convert_to_numpy_ret_vals=False):
    '\n        Parameters\n        ----------\n        feed_dict: a dictionary of node->np.ndarray supplied by user.\n        convert_to_numpy_ret_vals: whether to convert ret vals to np.array\n\n        Returns\n        -------\n        A list of values for nodes in eval_node_list. NDArray or np.ndarray.\n        '

    def are_feed_shapes_equal(sa, sb):
        if ((not isinstance(sa, dict)) or (not isinstance(sb, dict))):
            return False
        unmatched_item = (set(sa.items()) ^ set(sb.items()))
        return (len(unmatched_item) == 0)
    use_numpy = (self.ctx is None)
    node_to_val_map = {}
    for (node, value) in feed_dict.items():
        if use_numpy:
            assert isinstance(value, np.ndarray)
            node_to_val_map[node] = value
        elif isinstance(value, np.ndarray):
            node_to_val_map[node] = ndarray.array(value, ctx=self.ctx)
        elif isinstance(value, ndarray.NDArray):
            node_to_val_map[node] = value
        else:
            assert False, 'feed_dict value type not supported'
    feed_shapes = {}
    for node in node_to_val_map:
        feed_shapes[node] = node_to_val_map[node].shape
    if (not are_feed_shapes_equal(feed_shapes, self.feed_shapes)):
        self.infer_shape(feed_shapes)
        self.feed_shapes = feed_shapes
        if (not use_numpy):
            self.memory_plan(self.feed_shapes)
    for node in self.topo_order:
        if (node in node_to_val_map):
            continue
        input_vals = [node_to_val_map[n] for n in node.inputs]
        if use_numpy:
            node_val = np.empty(shape=self.node_to_shape_map[node])
        else:
            node_val = self.node_to_arr_map[node]
        node.op.compute(node, input_vals, node_val, use_numpy, self.stream)
        node_to_val_map[node] = node_val
    self.stream.sync()
    if ((not use_numpy) and convert_to_numpy_ret_vals):
        return [node_to_val_map[n].asnumpy() for n in self.eval_node_list]
    return [node_to_val_map[n] for n in self.eval_node_list]
Parameters
----------
feed_dict: a dictionary of node->np.ndarray supplied by user.
convert_to_numpy_ret_vals: whether to convert ret vals to np.array

Returns
-------
A list of values for nodes in eval_node_list. NDArray or np.ndarray.
def run(self, feed_dict, convert_to_numpy_ret_vals=False):
    '\n        Parameters\n        ----------\n        feed_dict: a dictionary of node->np.ndarray supplied by user.\n        convert_to_numpy_ret_vals: whether to convert ret vals to np.array\n\n        Returns\n        -------\n        A list of values for nodes in eval_node_list. NDArray or np.ndarray.\n        '

    def are_feed_shapes_equal(sa, sb):
        if ((not isinstance(sa, dict)) or (not isinstance(sb, dict))):
            return False
        unmatched_item = (set(sa.items()) ^ set(sb.items()))
        return (len(unmatched_item) == 0)
    use_numpy = (self.ctx is None)
    node_to_val_map = {}
    for (node, value) in feed_dict.items():
        if use_numpy:
            assert isinstance(value, np.ndarray)
            node_to_val_map[node] = value
        elif isinstance(value, np.ndarray):
            node_to_val_map[node] = ndarray.array(value, ctx=self.ctx)
        elif isinstance(value, ndarray.NDArray):
            node_to_val_map[node] = value
        else:
            assert False, 'feed_dict value type not supported'
    feed_shapes = {}
    for node in node_to_val_map:
        feed_shapes[node] = node_to_val_map[node].shape
    if (not are_feed_shapes_equal(feed_shapes, self.feed_shapes)):
        self.infer_shape(feed_shapes)
        self.feed_shapes = feed_shapes
        if (not use_numpy):
            self.memory_plan(self.feed_shapes)
    for node in self.topo_order:
        if (node in node_to_val_map):
            continue
        input_vals = [node_to_val_map[n] for n in node.inputs]
        if use_numpy:
            node_val = np.empty(shape=self.node_to_shape_map[node])
        else:
            node_val = self.node_to_arr_map[node]
        node.op.compute(node, input_vals, node_val, use_numpy, self.stream)
        node_to_val_map[node] = node_val
    self.stream.sync()
    if ((not use_numpy) and convert_to_numpy_ret_vals):
        return [node_to_val_map[n].asnumpy() for n in self.eval_node_list]
    return [node_to_val_map[n] for n in self.eval_node_list]