提交 dbc1b288 authored 作者: James Bergstra's avatar James Bergstra

merged in from trunk

TODO
BUGS
* 0.1 bugs in trac
CODE
* Automatic Op documentation listing
* Implement RNG
* Implement state
* 0.2: Verbose mode for compile.function
* Go over sandbox and figure out what is still relevant
EPYDOC
* Add WRITEME to code
* Go over and remove all WRITEME
TRAC
* Add a "Rename page" plugin
* CoreTutorial:
* In 0.2, rewrite as developer documentation of how theano.function works
* For the time being, take the basic structure and make a
"how theano.function works page", to be written, then remove
CoreTutorial page.
* When implementation of state is done, CompileFunction should be re-read.
* Fix timestamp macro
* Make sure [[Timestamp]] give us the timestamp when the timestamp was added
* If behavior is different, then remove all instances of Timestamp
* FrequentlyAskedQuestions
* Move out of user docs, since it is not necessary
* In the getting started page, make sure to have a link to the mailing lists.
* GraphStructures
* Needs an introduction.
* Go over and make sure all documentation is current.
* Need a short version of the page: What is a Graph, for Users
* Longer version: Graph documentation, for Developers
* Make sure we have a good sequential list of articles for newbies.
* WhatWhyHow, merged with WhatIsTheano
* Simple tutorial / walkthrough / cookbook
* Use Tensor always, don't bother with Scalars
* InstallationNotes
* Make sure to point out that new Numpy (>=1.1) fixes memory leaks
(Ticket #146)
* TerminologyGlossary
=== Maybe the following is more detailed user documentation, but not necessarily for newbies
* What is a graph?
* What is an Op?
* How to Make Tensors
* IntroToTypes
* IntroToOps
* GraphOptimization
Rewrite. (Assigned to Pascal)
* HowToDebug
* HowToMakeOps
* Fix up InstallationNotes page
* Make a page TipsForSpeed
* How to enable optimizations
* How to have the correct BLAS library. [see installation page]
* [Don't actually write this page, just indicate what should be written.]
* OpWishList
* ProposalCCodeGen
* RandomNumbers
* TensorVsScalar
* Also describe about bug #96 how certain types (not float or int)
won't work with Scalar graphs that are compiled to C.
* Read over all "polished documentation" and make sure it looks good
* Home page
* Make sure that all wiki pages are included in the home page
* Give a better summary of each wiki page
* Section
User docs
Dev docs
Proposals + discussions
Historical proposals + discussion
* Package 0.1 documentation, so we are free to update it
...@@ -603,11 +603,13 @@ class CAReduce(Op): ...@@ -603,11 +603,13 @@ class CAReduce(Op):
} }
""" % locals() """ % locals()
if len(axis) == 1: if node.inputs[0].type.ndim:
all_code = [("", "")] * nnested + [(task0_decl, code1), ""] if len(axis) == 1:
all_code = [("", "")] * nnested + [(task0_decl, code1), ""]
else:
all_code = [("", "")] * nnested + [(task0_decl, "")] + [("", "")] * (len(axis) - 2) + [("", code1), ""]
else: else:
all_code = [("", "")] * nnested + [(task0_decl, "")] + [("", "")] * (len(axis) - 2) + [("", code1), ""] all_code = [task0_decl + code1]
loop = cgen.make_loop([order, range(nnested) + ['x'] * len(axis)], [idtype, odtype], all_code, sub) loop = cgen.make_loop([order, range(nnested) + ['x'] * len(axis)], [idtype, odtype], all_code, sub)
return decl, checks, alloc, loop return decl, checks, alloc, loop
......
...@@ -376,127 +376,6 @@ def clone_get_equiv(i, o, copy_inputs_and_orphans = True): ...@@ -376,127 +376,6 @@ def clone_get_equiv(i, o, copy_inputs_and_orphans = True):
return d return d
## Previous version
# for input in i:
# if copy_inputs_and_orphans:
# cpy = input.clone()
# cpy.owner = None
# cpy.index = None
# d[input] = cpy
# else:
# d[input] = input
#
# def clone_helper(result):
# if result in d:
# return d[result]
# node = result.owner
# if node is None: # result is an orphan
# if copy_inputs_and_orphans:
# cpy = result.clone()
# d[result] = cpy
# else:
# d[result] = result
# return d[result]
# else:
# new_node = node.clone_with_new_inputs([clone_helper(input) for input in node.inputs])
# d[node] = new_node
# for output, new_output in zip(node.outputs, new_node.outputs):
# d[output] = new_output
# return d[result]
#
# for output in o:
# clone_helper(output)
#
# return d
# def clone_with_new_inputs(i, o, new_i):
# equiv = clone_with_new_inputs_get_equiv(i, o, new_i)
# return [equiv[input] for input in i], [equiv[output] for output in o]
# def clone_with_new_inputs_get_equiv(i, o, new_i, copy_orphans = True):
# # note: this does not exactly mirror Apply.clone_with_new_inputs
# # here it is possible to give different types to new_i and then
# # make_node is called on the ops instead of clone_with_new_inputs
# # whenever the type is different.
# d = {}
# for input, new_input in zip(i, new_i):
# d[input] = new_input
# def clone_helper(result):
# if result in d:
# return d[result]
# node = result.owner
# if node is None: # result is an orphan
# if copy_orphans:
# cpy = result.clone()
# d[result] = cpy
# else:
# d[result] = result
# return d[result]
# else:
# cloned_inputs = [clone_helper(input) for input in node.inputs]
# if any(input != cloned_input for input, cloned_input in zip(node.inputs, cloned_inputs)):
# new_node = node.op.make_node(*cloned_inputs)
# else:
# new_node = node.clone_with_new_inputs(cloned_inputs)
# d[node] = new_node
# for output, new_output in zip(node.outputs, new_node.outputs):
# d[output] = new_output
# return d[result]
# for output in o:
# clone_helper(output)
# return d
def clone_with_equiv(i, o, d, missing_input_policy = 'fail', orphan_policy = 'copy'):
def clone_helper(result):
if result in d:
return d[result]
node = result.owner
if node is None: # result is an input or an orphan not in d
if isinstance(result, Value):
if orphan_policy == 'copy':
d[result] = copy(result)
elif orphan_policy == 'keep':
d[result] = result
else:
raise ValueError("unknown orphan_policy: '%s'" % orphan_policy)
else:
if missing_input_policy == 'fail':
raise ValueError("missing input: %s" % result)
elif missing_input_policy == 'keep':
d[result] = result
else:
raise ValueError("unknown missing_input_policy: '%s'" % missing_input_policy)
return d[result]
else:
cloned_inputs = [clone_helper(input) for input in node.inputs]
if all(input is cloned_input for input, cloned_input in zip(node.inputs, cloned_inputs)):
new_node = node
else:
new_node = node.clone_with_new_inputs(cloned_inputs, strict = False)
# if any(input != cloned_input for input, cloned_input in zip(node.inputs, cloned_inputs)):
# new_node = node.op.make_node(*cloned_inputs)
# else:
# new_node = node.clone_with_new_inputs(cloned_inputs)
d[node] = new_node
for output, new_output in zip(node.outputs, new_node.outputs):
d[output] = new_output
return d[result]
for output in o:
clone_helper(output)
return [d[input] for input in i], [d[output] for output in o]
def general_toposort(r_out, deps, debug_print = False): def general_toposort(r_out, deps, debug_print = False):
""" """
@note: deps(i) should behave like a pure function (no funny business with @note: deps(i) should behave like a pure function (no funny business with
...@@ -561,8 +440,6 @@ def io_toposort(i, o, orderings = {}): ...@@ -561,8 +440,6 @@ def io_toposort(i, o, orderings = {}):
return [o for o in topo if isinstance(o, Apply)] return [o for o in topo if isinstance(o, Apply)]
default_leaf_formatter = str default_leaf_formatter = str
default_node_formatter = lambda op, argstrings: "%s(%s)" % (op.op, default_node_formatter = lambda op, argstrings: "%s(%s)" % (op.op,
", ".join(argstrings)) ", ".join(argstrings))
...@@ -667,3 +544,4 @@ def view_roots(r): ...@@ -667,3 +544,4 @@ def view_roots(r):
else: else:
return [r] return [r]
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论