原创 JNI修改Native方法數組參數中數組裏面的元素值

JNIEXPORT jintArray JNICALL Java_com_example_feisou_a02_1helloworld_JNI_arrElementsIncrease (JNIEnv *env, jobje

原创 50 行 PyTorch 代碼搞定 GAN

最近,一篇非常火的報道,使用pytorch 加 50 行核心代碼模擬 GAN  對抗神經網絡,自己嘗試走了一遍,並對源碼提出自己的理解。原文鏈接如下 https://medium.com/@devnag/generative-advers

原创 python 之 socket 通信

今天看了python 核心編程的第二章,講了關於python socket 模塊的通信, 記錄要點如下: 套接字: 1、AF_UNIX AF_INET 套接字地址:主機-端口對 面向連接的套接字:在通信之前必須建立一個連接,比如使用電話

原创 JNI c代碼回調java空方法

首先在class JNI中定義 public class JNI { static { System.loadLibrary("hello");//需要加載的so文件的名稱 } //傳遞兩個int

原创 LeetCode 155. Min Stack

解題思路:利用stack 重寫 MinStack() class MinStack { public: /** initialize your data structure here. */ stack<int>res;

原创 安裝torch7 深度學習框架

在centos7 上安裝torch7, 首先在github上下載,  git clone https://github.com/torch/distro.git ~/torch --recursive  獲取安裝LuaJIT(C語言編寫的

原创 數據結構之鏈表

#ifndef NODE_H #define NODE_H class Node { public: int data; Node *next; void printNode(); }; #endif #include "

原创 LeetCode 88. Merge Sorted Array

解題思路: 比較兩個數組的每個數的大小,從後往前比較,大的保存在nums1的最後,遍歷. class Solution { public: void merge(vector<int>& nums1, int m, vector<

原创 python 關鍵字之super

class C(B): def method(self, arg): super(C, self).method(arg) 子類C重寫了父類B中同名方法method,在重寫的實現中通過super實例化的代理對象調用父類的

原创 Swift3 基本語法

import Foundation print("Hello, World!") var a = 5 var b = 10 let c = a+b print(c,terminator:" ") var s = "hello xjc

原创 python 關鍵字之yield、next

包含yield 關鍵字的函數成爲一個迭代器,yield跟return的位置一樣,只不過每次返回結果後,並沒有退出,而是等待下一次迭代,下一次迭代開始後從yield後的語句開始執行,直到再次遇到yield,返回新一次的結果。可以看成是一個L

原创 Keras 切換GPU

https://keras.io/getting-started/faq/  查看Keras 官方文檔 If you are running on the TensorFlow backend, your code will autom

原创 數據結構之二叉樹 使用數組實現

二叉樹可以使用數組簡單的實現,其原理就是左右子節點和父節點的關係,  2*index + 1 爲左節點,2*index + 2 爲右節點 class Tree { public: Tree(int size,int *pRoot);

原创 JNI開發之c代碼中LOG打印調試信息

首先,在頭文件中包括<android/log.h> 然後聲明幾個宏定義 #include <android/log.h> #define LOG_TAG "Syste.out" #define LOGD(...) __android_l

原创 LeetCode 58. Length of Last Word

解題思路:使用 istringstream class Solution { public: int lengthOfLastWord(string s) { istringstream ss(s);