Пример #1
0
 def make_node(self, sqrtx, gz):
     sqrtx = as_tensor_variable(sqrtx)
     gz = as_tensor_variable(gz)
     assert sqrtx.ndim == 2
     assert gz.ndim == 2
     return Apply(self, [sqrtx, gz], [sqrtx.type()])
Пример #2
0
 def make_node(self, x):
     assert imported_scipy, (
         "Scipy not available. Scipy is needed for the Cholesky op")
     x = as_tensor_variable(x)
     assert x.ndim == 2
     return Apply(self, [x], [x.type()])
Пример #3
0
 def make_node(self, x, toAppend):
     assert isinstance(x.type, TypedListType)
     assert x.type == toAppend.type
     return Apply(self, [x, toAppend], [x.type()])
Пример #4
0
 def make_node(self, slc):
     return Apply(
         self, map(as_int_none_variable, [slc.start, slc.stop, slc.step]),
         [slicetype()])
Пример #5
0
 def make_node(self, x, i0, i1):
     _i0 = tensor.as_tensor_variable(i0)
     _i1 = tensor.as_tensor_variable(i1)
     return Apply(self, [x, _i0, _i1], [x.type()])
Пример #6
0
 def make_node(self, x):
     x = T.as_tensor_variable(x)
     if x.type.ndim != 4:
         raise TypeError('Input should be a 4-dim variable.')
     return Apply(self, [x], [x.type()])
Пример #7
0
 def make_node(self, x):
     x = T.as_tensor_variable(x)
     if x.type.ndim != 4:
         raise TypeError('U2IElemwiseSum inputs should be 4-dim tensor')
     return Apply(self, [x], [x.type()])
Пример #8
0
 def make_node(self, a, b):
     a = as_tensor_variable(a)
     b = as_tensor_variable(b)
     out_dtype = theano.scalar.upcast(a.dtype, b.dtype)
     x = theano.tensor.matrix(dtype=out_dtype)
     return Apply(self, [a, b], [x])
Пример #9
0
 def make_node(self, _x):
     x = as_tensor_variable(_x)
     if x.type.ndim != 1:
         raise TypeError('AllocDiag only works on vectors', _x)
     return Apply(self, [x], [theano.tensor.matrix(dtype=x.type.dtype)])
Пример #10
0
 def make_node(self, c1, t1, c2, t2, c3, t3, f3):
     assert t1.type == f3.type
     assert t2.type == t3.type
     assert t3.type == f3.type
     return Apply(self, [c1, t1, c2, t2, c3, t3, f3], [t1.type()])
Пример #11
0
 def make_node(self, a):
     a = as_tensor_variable(a)
     out = a.type()
     return Apply(self, [a], [out])
Пример #12
0
 def make_node(self, h1, h2):
     h1 = as_tensor_variable(h1)
     h2 = as_tensor_variable(h2)
     otype = tensor.tensor(broadcastable=(False, False), dtype='float32')
     return Apply(self, [h1, h2], [otype])
Пример #13
0
 def make_node(self, input):
     input = scalar.as_scalar(input)
     output = input.type()
     return Apply(self, [input], [output])
Пример #14
0
 def make_node(self, x):
     # Must work for all type that have a shape attribute.
     # This will fail at execution time.
     if not isinstance(x, theano.Variable):
         x = theano.tensor.as_tensor_variable(x)
     return Apply(self, [x], [theano.tensor.lvector()])
Пример #15
0
 def make_node(self, x):
     assert isinstance(x.type, TypedListType)
     return Apply(self, [x], [T.scalar(dtype='int64')])
Пример #16
0
 def make_node(self, x):
     x = as_tensor_variable(x)
     assert x.ndim == 2
     o = theano.tensor.scalar(dtype=x.dtype)
     return Apply(self, [x], [o])
Пример #17
0
 def make_node(self, x, gz):
     out = x.type()
     return Apply(self, [x, gz], [out])
Пример #18
0
 def make_node(self, x):
     x = as_tensor_variable(x)
     assert x.ndim == 2
     w = theano.tensor.vector(dtype=x.dtype)
     v = theano.tensor.matrix(dtype=x.dtype)
     return Apply(self, [x], [w, v])
Пример #19
0
 def make_node(self, x):
     x = T.as_tensor_variable(x)
     return Apply(self, [x], [x.type()])
Пример #20
0
 def make_node(self, x):
     x = as_tensor_variable(x)
     assert x.ndim == 2, "The input of qr function should be a matrix."
     q = theano.tensor.matrix(dtype=x.dtype)
     r = theano.tensor.matrix(dtype=x.dtype)
     return Apply(self, [x], [q, r])
Пример #21
0
 def make_node(self, x):
     x = as_tensor_variable(x)
     assert x.ndim == 2, "The input should be a matrix."
     z = theano.tensor.matrix(dtype=x.dtype)
     return Apply(self, [x], [z])
Пример #22
0
 def make_node(self, x):
     x = as_tensor_variable(x)
     assert x.ndim == 2
     return Apply(self, [x], [x.type()])
Пример #23
0
 def make_node(self, x):
     return Apply(self, [x], [x.type()])
Пример #24
0
 def make_node(self, xin):
     xout = xin.type()
     return Apply(op=self, inputs=[xin], outputs=[xout])
Пример #25
0
 def make_node(self, *inputs):
     # Checking if arguments are of the right type is done in the scan
     # function
     out_types = [out.type() for out in self.outputs]
     return Apply(self, inputs, out_types)
Пример #26
0
 def make_node(self, x):
     assert isinstance(x.type, TypedListType)
     return Apply(self, [x], [x.type()])
Пример #27
0
 def make_node(self, x):
     x = theano.tensor.as_tensor_variable(x)
     o = theano.tensor.scalar(dtype=x.dtype)
     return Apply(self, [x], [o])
Пример #28
0
 def make_node(self, x, elem):
     assert isinstance(x.type, TypedListType)
     assert x.ttype == elem.type
     return Apply(self, [x, elem], [T.scalar()])
Пример #29
0
 def make_node(self, x, toRemove):
     assert isinstance(x.type, TypedListType)
     assert x.ttype == toRemove.type
     return Apply(self, [x, toRemove], [x.type()])
Пример #30
0
 def make_node(self, dy, sm, **kwargs):
     dy = tensor.as_tensor_variable(dy)
     sm = tensor.as_tensor_variable(sm)
     return Apply(self, [dy, sm], [sm.type.make_variable()])