1import torch
2import torch.nn as nn
3import torch.nn.functional as F
4
5
6class BidirectionalLSTM(nn.Module):
7 def __init__(self, n_in, n_hidden, n_out):
8 super(BidirectionalLSTM, self).__init__()
9
10 self.rnn = nn.LSTM(n_in, n_hidden, bidirectional=True)
11 self.embedding = nn.Linear(n_hidden * 2, n_out)
12
13 def forward(self, input):
14 recurrent, _ = self.rnn(input)
15 T, b, h = recurrent.size()
16 t_rec = recurrent.view(T * b, h)
17
18 output = self.embedding(t_rec) # [T * b, nOut]
19 output = output.view(T, b, -1)
20 return output
1#include <iostream>
2#include <string.h>
3using namespace std;
4int main()
5{
6 int z,a[3],b[3],al=0,bo=0;
7 for(int i=0;i<3;i++)
8 cin>>a[i];
9 for(int i=0;i<3;i++)
10 cin>>b[i];
11 for(int i=0;i<3;i++)
12 {
13 if(a[i]==b[i])
14 {z++;}
15 else
16 if(a[i]>b[i])
17 al++;
18 else
19 bo++;
20 }
21 cout<<al<<" "<<bo;
22
23 return 0;
24}using namespace std;
25
26// Function to convert Indian Numeric
27// System to International Numeric System
28string convert(string input)
29{
30 // Length of the input string
31 int len = input.length();
32
33 // Removing all the separators(, )
34 // From the input string
35 for (int i = 0; i < len; i++) {
36 if (input[i] == ',') {
37 input.erase(input.begin() + i);
38 len--;
39 i--;
40 }
41 }
42
43 // Initialize output string
44 string output = "";
45 int ctr = 0;
46
47 // Process the input string
48 for (int i = len - 1; i >= 0; i--) {
49
50 ctr++;
51 output = input[i] + output;
52
53 // Add a separator(, ) after
54 // every third digit
55 if (ctr % 3 == 0 && ctr < len) {
56 output = ',' + output;
57 }
58 }
59
60 // Return the output string back
61 // to the main function
62 return output;
63}
64
65// Driver Code
66int main()
67{
68 string input1 = "12,34,56,789";
69 string input2 = "90,05,00,00,000";
70
71 cout << convert(input1) << endl;
72 cout << convert(input2) << endl;
73}
1#include <iostream>
2#include <cstdlib>
3using namespace std;
4
5int main()
6{
7 double x = 0;
8 cout << "x = ";
9 cin >> x;
10 // Логическое выражение.
11 cout << "x*x < 2 == " << (x*x < 2) << endl;
12 return EXIT_SUCCESS;
13}