小编rez*_*esh的帖子

可视化theano Convolutional MLP中每层的输出

我正在阅读卷积神经网络教程.我希望在训练模型后可视化每层的输出.例如,在函数"evaluate_lenet5"中,我想将一个实例(它是一个图像)传递给网络,并查看每个图层的输出以及为输入设置训练神经网络的类.我认为在每个图层的图像和权重向量上做点积可能很容易,但它根本不起作用.

我有每个图层的对象:

# Reshape matrix of rasterized images of shape (batch_size, 28 * 28)
# to a 4D tensor, compatible with our LeNetConvPoolLayer
# (28, 28) is the size of MNIST images.
layer0_input = x.reshape((batch_size, 1, 28, 28))

# Construct the first convolutional pooling layer:
# filtering reduces the image size to (28-5+1 , 28-5+1) = (24, 24)
# maxpooling reduces this further to (24/2, 24/2) = (12, 12)
# 4D output tensor is thus of shape (batch_size, …
Run Code Online (Sandbox Code Playgroud)

numpy python-2.7 theano deep-learning conv-neural-network

5
推荐指数
1
解决办法
1103
查看次数

Spring Boot安全考虑不区分大小写的用户名登录

我正在开发一个Spring Boot Web应用程序。问题出在登录方案中。假设我有一个用用户名“ Ali”注册的用户。该用户可以使用用户名“ Ali”或“ ali”登录。下面的代码代表了我的spring安全配置类。似乎在比较时,Spring Boot不会检查大写小写因子,但我希望对其进行检查。

软件包ir.saafta.conf;

导入ir.saafta.repo.EventRepository;
导入org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
导入org.springframework.context.annotation.Bean;
导入org.springframework.context.annotation.Configuration;
导入org.springframework.http.HttpMethod;
导入org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.security.web.header.writers.StaticHeadersWriter;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.sql.DataSource;

/**
 * Created by reza on 11/12/16.
 */
@Configuration
public class SecurityConf extends WebSecurityConfigurerAdapter {

    @Autowired
    private DataSource datasource;
    @Autowired
    private EventRepository eventRepository;

    // Register …

spring spring-security spring-boot spring-security-rest

5
推荐指数
1
解决办法
1576
查看次数

以角度向下钻取图表

我想在我的角度应用程序中有一个柱形图,可以钻到折线图.我认为主要的问题是要能够处理点击,我找不到它的每一列事件highchartangular-chart.你能告诉我一种构建这种东西的方法吗?

charts drilldown angularjs

4
推荐指数
1
解决办法
3095
查看次数

Gulp错误:ENOENT,lstat在运行任务时

我正在使用gulp来复制和清理我的前端项目.我想运行一些顺序任务.这意味着,例如,我希望启动并完成复制任务,然后运行以下任务(复制任务).我在运行任务时经常看到这个错误:

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: ENOENT, lstat '/home/reza/projects/account-web/dist/views'
Run Code Online (Sandbox Code Playgroud)

之后lstat,我每个人都会随机看到一个文件名.我只是发现当没有dist文件夹或者它是空的复制任务正常运行但是当dist文件夹不为空时甚至干净的任务抛出和错误.我的gulp文件和命令结果如下:

var gulp = require('gulp');
var clean = require('gulp-clean');
var merge = require('gulp-merge');
var runSequence = require('run-sequence');

gulp.task('clean', function () {
    gulp.src('./dist/**').pipe(clean());
});

gulp.task('copy-js', function () {
    return gulp.src('app/js/**').pipe(gulp.dest('dist/js/'));
});
gulp.task('copy-bower', function () {
    return     gulp.src('bower_components/**').pipe(gulp.dest('dist/bower_components/'));
});
gulp.task('copy-script', function () {
    return     gulp.src('app/scripts/**').pipe(gulp.dest('dist/scripts/'));
});
gulp.task('copy-styles', function () {
    var stream1 =     gulp.src('app/styles/**').pipe(gulp.dest('dist/styles/'));
    var stream2 =     gulp.src('app/fonts/**').pipe(gulp.dest('dist/fonts/'));
    var stream3 = gulp.src('app/img/**').pipe(gulp.dest('dist/img/'));
    return merge(stream1, stream2, stream3);
}); …
Run Code Online (Sandbox Code Playgroud)

web-frontend node.js gulp

3
推荐指数
1
解决办法
4848
查看次数

角度反应形式在(更改)事件回调上具有旧值

考虑带有输入的 Angular 反应形式。每当输入发生变化时,我们都希望保留其旧值并将其显示在某个地方。下面的代码按照显示的方式执行此操作:

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent {
  name = 'Reactive Form';
  changedValue;
  oldValue;
  ooldValue;
  rform = new FormGroup({
    inputOne: new FormControl('chang me')
  });


  onOneChange(event) {
    this.changedValue = event.target.value;
    console.log('oneChanged', this.changedValue, 'old value is', this.oldValue);
    this.ooldValue = this.oldValue;
    setTimeout( ()=>this.oldValue = this.changedValue, 1);
  }
}
Run Code Online (Sandbox Code Playgroud)
<form [formGroup]="rform">
    <label>
      One:
      <input formControlName="inputOne" (change)="onOneChange($event)"/>
    </label>
  </form>
  <p>
    changed value: {{changedValue}}
  </p>
  <p>
        old value: {{ooldValue}}
  </p>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,它已通过在代码中保留三个变量来解决,这是不可取的(是的,changedValue可以删除该变量,但仍然有两个变量保留旧值很烦人,不是吗?)。

有没有办法用更少的变量重写代码?Angular 本身有下降的方式来做到这一点吗?

您可以在这里找到代码

javascript angular2-forms angular angular-reactive-forms angular-event-emitter

2
推荐指数
1
解决办法
7615
查看次数

如何在c中创建不同大小的数组?

我将在c中有一个数组数组,因为主数组中的每个数组都有一个特定的大小.例如:{{a,b,c},{a},{a,d}}问题是我不想使用堆内存并使用"malloc",它也不应该是任何浪费的内存.例如,我不想使用以下代码:

char myArrays[][3] = {
 {a,b,c},
 {a,null,null},
 {a,d,null}
} 
Run Code Online (Sandbox Code Playgroud)

c arrays

0
推荐指数
1
解决办法
1037
查看次数