You just have to declare a symbolic input variable representing the sparse 
matrix, use it in the computation graph, compile a theano.function, and 
then pass the value when calling it.
See the examples at 
http://deeplearning.net/software/theano/library/sparse/index.html#csr-matrix 
in particular.

On Monday, July 17, 2017 at 11:55:50 AM UTC-4, Lalit Pradhan wrote:
>
> Hi, 
>
> I have:
> A scipy sparse matrix 'csr' with shape (262144, 262144)  and 6522916 non 
> zero rows
> and 
> A theano tensor variable, a flattened (512*512) = 262144 output of a 
> feature map.
>
> I want to do a dot product in theano between them. How can i convert the 
> scipy sparse matrix into a theano sparse matrix? How do I go about this 
> task?
>
> Thanks,
> Lalit
>
>
>
> On Tuesday, March 5, 2013 at 2:21:43 AM UTC+5:30, Frédéric Bastien wrote:
>>
>> I split the PR, the new PR is: https://github.com/Theano/Theano/pull/1264 
>>
>> I updated your name. 
>>
>> thanks 
>>
>> Fred 
>>
>> On Mon, Mar 4, 2013 at 3:08 PM, bizso09 <[email protected]> wrote: 
>> > thank you for the credit. If we are going formal, you can include my 
>> real 
>> > name which is Zsolt Bitvai, no less peculiar 
>> > 
>> > 
>> > On Mon, Mar 4, 2013 at 6:43 PM, Frédéric Bastien <[email protected]> 
>> wrote: 
>> >> 
>> >> The fix are in PR: https://github.com/Theano/Theano/pull/1263 
>> >> 
>> >> thanks for the report. 
>> >> 
>> >> Fred 
>> >> 
>> >> On Mon, Mar 4, 2013 at 1:40 PM, Frédéric Bastien <[email protected]> 
>> wrote: 
>> >> > I have a fix in preparation. 
>> >> > 
>> >> > The problem is sparse.Dot.make_node. It was always making a matrix 
>> >> > output even if the inputs aren't matrices. 
>> >> > 
>> >> > Fred 
>> >> > 
>> >> > On Mon, Mar 4, 2013 at 1:35 PM, Pascal Lamblin 
>> >> > <[email protected]> wrote: 
>> >> >> On Mon, Mar 04, 2013, bizso09 wrote: 
>> >> >>> theano.printing.debugprint(r) 
>> >> >>> 
>> >> >>> SparseDot [@A] '' 
>> >> >>>  |SparseVariable{csc,float64} [@B] 
>> >> >>>  |Subtensor{::, 3} [@C] '' 
>> >> >>>    |W [@D] 
>> >> >> 
>> >> >> I'm guessing the problem is that SparseDot.infer_shape returns 
>> >> >> something 
>> >> >> of length 1, because one of the inputs is a vector, but it should 
>> be of 
>> >> >> length 2, because the output is a sparse matrix, as there are no 
>> sparse 
>> >> >> vectors. 
>> >> >> 
>> >> >>> I'm running '0.6.0rc3' When I try to upgrade I get an error 
>> though. 
>> >> >>> 
>> >> >>> sudo pip install --upgrade theano 
>> >> >>> Command python setup.py egg_info failed with error code 1 in 
>> >> >>> /home/user/build/scipy 
>> >> >> 
>> >> >> 0.6.0rc3 is the last release candidate at the moment, so it's OK. 
>> >> >> In the future, you should run "sudo pip install --upgrade --no-deps 
>> >> >> theano". 
>> >> >> The "--no-deps" bit ensures you upgrade only Theano, not scipy and 
>> >> >> numpy. 
>> >> >> 
>> >> >> -- 
>> >> >> Pascal 
>> >> >> 
>> >> >> -- 
>> >> >> 
>> >> >> --- 
>> >> >> You received this message because you are subscribed to the Google 
>> >> >> Groups "theano-users" group. 
>> >> >> To unsubscribe from this group and stop receiving emails from it, 
>> send 
>> >> >> an email to [email protected]. 
>> >> >> For more options, visit https://groups.google.com/groups/opt_out. 
>> >> >> 
>> >> >> 
>> >> 
>> >> -- 
>> >> 
>> >> --- 
>> >> You received this message because you are subscribed to a topic in the 
>> >> Google Groups "theano-users" group. 
>> >> To unsubscribe from this topic, visit 
>> >> 
>> https://groups.google.com/d/topic/theano-users/_rEHTO06utQ/unsubscribe?hl=en.
>>  
>>
>> >> To unsubscribe from this group and all its topics, send an email to 
>> >> [email protected]. 
>> >> 
>> >> For more options, visit https://groups.google.com/groups/opt_out. 
>> >> 
>> >> 
>> > 
>> > -- 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "theano-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to [email protected]. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to