theano/gof/op.py
def make_c_thunk(self, node, storage_map, compute_map, no_recycling):
        """Like make_thunk, but will only try to make a C thunk.

        """
        node_input_storage = [storage_map[r] for r in node.inputs]
        node_output_storage = [storage_map[r] for r in node.outputs]

        e = FunctionGraph(node.inputs, node.outputs)
        e_no_recycling = [new_o
                          for (new_o, old_o) in zip(e.outputs, node.outputs)
                          if old_o in no_recycling]
        cl = theano.gof.cc.CLinker().accept(e,
                                            no_recycling=e_no_recycling)
        # float16 gets special treatment since running
        # unprepared C code will get bad results.
        if not getattr(self, '_f16_ok', False):
            def is_f16(t):
                return getattr(t, 'dtype', '') == 'float16'

            if (any(is_f16(i.type) for i in node.inputs) or
                    any(is_f16(o.type) for o in node.outputs)):
                # get_dynamic_module is a subset of make_thunk that is reused.
                # This just try to build the c code
                # It will raise an error for ops
                # that don't implement c code. In those cases, we
                # don't want to print a warning.
                cl.get_dynamic_module()
                print("Disabling C code for %s due to unsupported "
                      "float16" % (self,))
                raise NotImplementedError("float16")
        _logger.debug('Trying CLinker.make_thunk')
        outputs = cl.make_thunk(input_storage=node_input_storage,
                                output_storage=node_output_storage)
        thunk, node_input_filters, node_output_filters = outputs

        def rval():
            thunk()
            for o in node.outputs:
                compute_map[o][0] = True

        rval.thunk = thunk
        rval.cthunk = thunk.cthunk
        rval.inputs = node_input_storage
        rval.outputs = node_output_storage
        rval.lazy = False
        return rval
Like make_thunk, but will only try to make a C thunk.

        
Like make_thunk, but will only try to make a C thunk.
Like make_thunk but will only try to make a C thunk .
def make_c_thunk(self, node, storage_map, compute_map, no_recycling):
        node_input_storage = [storage_map[r] for r in node.inputs]
        node_output_storage = [storage_map[r] for r in node.outputs]
        e = FunctionGraph(node.inputs, node.outputs)
        e_no_recycling = [new_o
                          for (new_o, old_o) in zip(e.outputs, node.outputs)
                          if old_o in no_recycling]
        cl = theano.gof.cc.CLinker().accept(e,
                                            no_recycling=e_no_recycling)
        if not getattr(self, '_f16_ok', False):
            def is_f16(t):
                return getattr(t, 'dtype', '') == 'float16'
            if (any(is_f16(i.type) for i in node.inputs) or
                    any(is_f16(o.type) for o in node.outputs)):
                cl.get_dynamic_module()
                print("Disabling C code for %s due to unsupported "
                      "float16" % (self,))
                raise NotImplementedError("float16")
        _logger.debug('Trying CLinker.make_thunk')
        outputs = cl.make_thunk(input_storage=node_input_storage,
                                output_storage=node_output_storage)
        thunk, node_input_filters, node_output_filters = outputs
        def rval():
            thunk()
            for o in node.outputs:
                compute_map[o][0] = True
        rval.thunk = thunk
        rval.cthunk = thunk.cthunk
        rval.inputs = node_input_storage
        rval.outputs = node_output_storage
        rval.lazy = False
        return rval
def make_c_thunk ( self , node , storage_map , compute_map , no_recycling ) : node_input_storage = [ storage_map [ r ] for r in node . inputs ] node_output_storage = [ storage_map [ r ] for r in node . outputs ] e = FunctionGraph ( node . inputs , node . outputs ) e_no_recycling = [ new_o for ( new_o , old_o ) in zip ( e . outputs , node . outputs ) if old_o in no_recycling ] cl = theano . gof . cc . CLinker ( ) . accept ( e , no_recycling = e_no_recycling ) if not getattr ( self , '_f16_ok' , False ) : def is_f16 ( t ) : return getattr ( t , 'dtype' , '' ) == 'float16' if ( any ( is_f16 ( i . type ) for i in node . inputs ) or any ( is_f16 ( o . type ) for o in node . outputs ) ) : cl . get_dynamic_module ( ) print ( "Disabling C code for %s due to unsupported " "float16" % ( self , ) ) raise NotImplementedError ( "float16" ) _logger . debug ( 'Trying CLinker.make_thunk' ) outputs = cl . make_thunk ( input_storage = node_input_storage , output_storage = node_output_storage ) thunk , node_input_filters , node_output_filters = outputs def rval ( ) : thunk ( ) for o in node . outputs : compute_map [ o ] [ 0 ] = True rval . thunk = thunk rval . cthunk = thunk . cthunk rval . inputs = node_input_storage rval . outputs = node_output_storage rval . lazy = False return rval
Like make_thunk, but will only try to make a C thunk.
Like make_thunk but will only try to make a C thunk .
"""Like make_thunk, but will only try to make a C thunk.

        """ # float16 gets special treatment since running # unprepared C code will get bad results. # get_dynamic_module is a subset of make_thunk that is reused. # This just try to build the c code # It will raise an error for ops # that don't implement c code. In those cases, we # don't want to print a warning.
self
node
storage_map
compute_map
no_recycling